Changeset 163fc09 in mainline
- Timestamp:
- 2017-04-02T11:47:52Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ce04ea44
- Parents:
- 151f1cc
- Location:
- uspace
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/mv/mv.c
r151f1cc r163fc09 30 30 #include <stdlib.h> 31 31 #include <errno.h> 32 #include <vfs/vfs.h> 32 33 #include "config.h" 33 34 #include "util.h" … … 59 60 } 60 61 61 rc = rename(argv[1], argv[2]);62 if (rc != 0) {62 rc = vfs_rename_path(argv[1], argv[2]); 63 if (rc != EOK) { 63 64 printf("Unable to rename %s to %s (error=%d)\n", 64 argv[1], argv[2], errno);65 argv[1], argv[2], rc); 65 66 return CMD_FAILURE; 66 67 } -
uspace/app/tester/vfs/vfs1.c
r151f1cc r163fc09 114 114 return rv; 115 115 116 if ( rename(TEST_FILE, TEST_FILE2) != 0)117 return " rename() failed";116 if (vfs_rename_path(TEST_FILE, TEST_FILE2) != EOK) 117 return "vfs_rename_path() failed"; 118 118 TPRINTF("Renamed %s to %s\n", TEST_FILE, TEST_FILE2); 119 119 -
uspace/lib/c/generic/vfs/vfs.c
r151f1cc r163fc09 833 833 * @param new New name 834 834 * 835 * @return 0 on success. On error returns -1 and sets errno.836 */ 837 int rename(const char *old, const char *new)835 * @return EOK on success or a negative error code otherwise. 836 */ 837 int vfs_rename_path(const char *old, const char *new) 838 838 { 839 839 sysarg_t rc; … … 843 843 size_t olda_size; 844 844 char *olda = vfs_absolutize(old, &olda_size); 845 if (olda == NULL) { 846 errno = ENOMEM; 847 return -1; 848 } 845 if (olda == NULL) 846 return ENOMEM; 849 847 850 848 size_t newa_size; … … 852 850 if (newa == NULL) { 853 851 free(olda); 854 errno = ENOMEM; 855 return -1; 852 return ENOMEM; 856 853 } 857 854 … … 861 858 free(olda); 862 859 free(newa); 863 errno = ENOENT; 864 return -1; 860 return ENOENT; 865 861 } 866 862 … … 875 871 if (rc_orig != EOK) 876 872 rc = rc_orig; 877 if (rc != EOK) { 878 errno = rc; 879 return -1; 880 } 881 return 0; 873 return rc; 882 874 } 883 875 rc = async_data_write_start(exch, newa, newa_size); … … 890 882 if (rc_orig != EOK) 891 883 rc = rc_orig; 892 if (rc != EOK) { 893 errno = rc; 894 return -1; 895 } 896 return 0; 884 return rc; 897 885 } 898 886 vfs_exchange_end(exch); … … 902 890 async_wait_for(req, &rc); 903 891 904 if (rc != EOK) { 905 errno = rc; 906 return -1; 907 } 908 909 return 0; 892 return rc; 910 893 } 911 894 -
uspace/lib/c/include/stdio.h
r151f1cc r163fc09 141 141 extern void setbuf(FILE *, void *); 142 142 143 /* Misc file functions */144 extern int rename(const char *, const char *);145 146 143 #endif 147 144 -
uspace/lib/c/include/vfs/vfs.h
r151f1cc r163fc09 96 96 extern int vfs_open(int, int); 97 97 extern int vfs_put(int); 98 extern int vfs_rename_path(const char *, const char *); 98 99 extern int vfs_resize(int, aoff64_t); 99 100 extern int vfs_root(void); -
uspace/lib/posix/source/stdio.c
r151f1cc r163fc09 590 590 int posix_rename(const char *old, const char *new) 591 591 { 592 return negerrno(rename, old, new); 592 int rc = rcerrno(vfs_rename_path, old, new); 593 if (rc != EOK) 594 return -1; 595 else 596 return 0; 593 597 } 594 598
Note:
See TracChangeset
for help on using the changeset viewer.