Changeset d96d9bc in mainline for uspace/lib/c/generic/vfs/vfs.c
- Timestamp:
- 2017-04-02T20:38:50Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c23275a
- Parents:
- 1e2e5795
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/vfs/vfs.c
r1e2e5795 rd96d9bc 808 808 * 809 809 * @param path Path 810 * @return 0 on success. On error returns -1 and sets errno.811 */ 812 int chdir(const char *path)810 * @return EOK on success or a negative error code otherwise. 811 */ 812 int vfs_cwd_set(const char *path) 813 813 { 814 814 size_t abs_size; 815 815 char *abs = vfs_absolutize(path, &abs_size); 816 if (!abs) { 817 errno = ENOMEM; 818 return -1; 819 } 816 if (!abs) 817 return ENOMEM; 820 818 821 819 int fd = vfs_lookup(abs, WALK_DIRECTORY); 822 820 if (fd < 0) { 823 821 free(abs); 824 errno = fd; 825 return -1; 822 return fd; 826 823 } 827 824 … … 839 836 840 837 fibril_mutex_unlock(&cwd_mutex); 841 return 0;838 return EOK; 842 839 } 843 840 … … 846 843 * @param buf Buffer 847 844 * @param size Size of @a buf 848 * @return On success returns @a buf. On failure returns @c NULL and sets errno. 849 */ 850 char *getcwd(char *buf, size_t size) 851 { 852 if (size == 0) { 853 errno = EINVAL; 854 return NULL; 855 } 856 845 * @return EOK on success and a non-negative error code otherwise. 846 */ 847 int vfs_cwd_get(char *buf, size_t size) 848 { 857 849 fibril_mutex_lock(&cwd_mutex); 858 850 859 851 if ((cwd_size == 0) || (size < cwd_size + 1)) { 860 852 fibril_mutex_unlock(&cwd_mutex); 861 errno = ERANGE; 862 return NULL; 853 return ERANGE; 863 854 } 864 855 … … 866 857 fibril_mutex_unlock(&cwd_mutex); 867 858 868 return buf;859 return EOK; 869 860 } 870 861
Note:
See TracChangeset
for help on using the changeset viewer.