Changes in uspace/lib/c/generic/vfs/vfs.c [089385e8:6b8e5b7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/vfs/vfs.c
r089385e8 r6b8e5b7 58 58 static async_sess_t *vfs_sess = NULL; 59 59 60 /* Current (working) directory. */61 60 static FIBRIL_MUTEX_INITIALIZE(cwd_mutex); 61 62 62 static int cwd_fd = -1; 63 63 static char *cwd_path = NULL; 64 64 static size_t cwd_size = 0; 65 66 /* Previous directory. */67 static FIBRIL_MUTEX_INITIALIZE(pwd_mutex);68 static int pwd_fd = -1;69 static char *pwd_path = NULL;70 static size_t pwd_size = 0;71 72 65 73 66 /** Start an async exchange on the VFS session. … … 758 751 fibril_mutex_lock(&cwd_mutex); 759 752 760 761 fibril_mutex_lock(&pwd_mutex); 762 763 if (pwd_fd >= 0) 764 close(pwd_fd); 765 766 767 if (pwd_path) 768 free(pwd_path); 769 770 771 pwd_fd = cwd_fd; 772 pwd_path = cwd_path; 773 pwd_size = cwd_size; 774 775 fibril_mutex_unlock(&pwd_mutex); 776 753 if (cwd_fd >= 0) 754 close(cwd_fd); 755 756 757 if (cwd_path) 758 free(cwd_path); 759 777 760 cwd_fd = fd; 778 761 cwd_path = abs; … … 798 781 fibril_mutex_unlock(&cwd_mutex); 799 782 800 return buf;801 }802 803 804 char *getprevwd(char *buf, size_t size)805 {806 if (size == 0)807 return NULL;808 809 fibril_mutex_lock(&pwd_mutex);810 811 if ((pwd_size == 0) || (size < pwd_size + 1)) {812 fibril_mutex_unlock(&pwd_mutex);813 return NULL;814 }815 816 str_cpy(buf, size, pwd_path);817 fibril_mutex_unlock(&pwd_mutex);818 819 783 return buf; 820 784 }
Note:
See TracChangeset
for help on using the changeset viewer.