Changeset 58115ae in mainline
- Timestamp:
- 2011-07-27T23:05:15Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 75406dc
- Parents:
- fd4b636
- Location:
- uspace/lib/posix
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/stdio.c
rfd4b636 r58115ae 693 693 694 694 /** 695 * Remove a file .695 * Remove a file or directory. 696 696 * 697 697 * @param path Pathname of the file that shall be removed. 698 * @return Zero on success, -1 otherwise.698 * @return Zero on success, -1 (with errno set) otherwise. 699 699 */ 700 700 int posix_remove(const char *path) 701 701 { 702 // FIXME: unlink() and rmdir() seem to be equivalent at the moment, 703 // but that does not have to be true forever 704 return unlink(path); 702 struct stat st; 703 int rc = stat(path, &st); 704 705 if (rc != EOK) { 706 errno = -rc; 707 return -1; 708 } 709 710 if (st.is_directory) { 711 rc = rmdir(path); 712 } else { 713 rc = unlink(path); 714 } 715 716 if (rc != EOK) { 717 errno = -rc; 718 return -1; 719 } 720 return 0; 705 721 } 706 722 -
uspace/lib/posix/unistd.c
rfd4b636 r58115ae 176 176 return rc; 177 177 } 178 } 179 180 /** 181 * Remove a directory. 182 * 183 * @param path Directory pathname. 184 * @return Zero on success, -1 otherwise. 185 */ 186 int posix_rmdir(const char *path) 187 { 188 int rc = rmdir(path); 189 if (rc != EOK) { 190 errno = -rc; 191 return -1; 192 } 193 return 0; 178 194 } 179 195 -
uspace/lib/posix/unistd.h
rfd4b636 r58115ae 73 73 74 74 /* Deleting Files */ 75 extern int posix_rmdir(const char *path); 75 76 extern int posix_unlink(const char *path); 76 77 … … 156 157 #define read posix_read 157 158 159 #define rmdir posix_rmdir 158 160 #define unlink posix_unlink 159 161
Note:
See TracChangeset
for help on using the changeset viewer.