Changes in uspace/lib/c/generic/vfs/vfs.c [6b8e5b7:089385e8] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/vfs/vfs.c
r6b8e5b7 r089385e8 58 58 static async_sess_t *vfs_sess = NULL; 59 59 60 /* Current (working) directory. */ 60 61 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 65 72 66 73 /** Start an async exchange on the VFS session. … … 751 758 fibril_mutex_lock(&cwd_mutex); 752 759 753 if (cwd_fd >= 0) 754 close(cwd_fd); 755 756 757 if (cwd_path) 758 free(cwd_path); 759 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 760 777 cwd_fd = fd; 761 778 cwd_path = abs; … … 781 798 fibril_mutex_unlock(&cwd_mutex); 782 799 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 783 819 return buf; 784 820 }
Note:
See TracChangeset
for help on using the changeset viewer.