Changeset 163fc09 in mainline for uspace/lib/c/generic/vfs/vfs.c


Ignore:
Timestamp:
2017-04-02T11:47:52Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ce04ea44
Parents:
151f1cc
Message:

Rename rename() to vfs_rename_path()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/vfs/vfs.c

    r151f1cc r163fc09  
    833833 * @param new New name
    834834 *
    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 */
     837int vfs_rename_path(const char *old, const char *new)
    838838{
    839839        sysarg_t rc;
     
    843843        size_t olda_size;
    844844        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;
    849847
    850848        size_t newa_size;
     
    852850        if (newa == NULL) {
    853851                free(olda);
    854                 errno = ENOMEM;
    855                 return -1;
     852                return ENOMEM;
    856853        }
    857854       
     
    861858                free(olda);
    862859                free(newa);
    863                 errno = ENOENT;
    864                 return -1;
     860                return ENOENT;
    865861        }
    866862       
     
    875871                if (rc_orig != EOK)
    876872                        rc = rc_orig;
    877                 if (rc != EOK) {
    878                         errno = rc;
    879                         return -1;
    880                 }
    881                 return 0;
     873                return rc;
    882874        }
    883875        rc = async_data_write_start(exch, newa, newa_size);
     
    890882                if (rc_orig != EOK)
    891883                        rc = rc_orig;
    892                 if (rc != EOK) {
    893                         errno = rc;
    894                         return -1;
    895                 }
    896                 return 0;
     884                return rc;
    897885        }
    898886        vfs_exchange_end(exch);
     
    902890        async_wait_for(req, &rc);
    903891
    904         if (rc != EOK) {
    905                 errno = rc;
    906                 return -1;
    907         }
    908 
    909         return 0;
     892        return rc;
    910893}
    911894
Note: See TracChangeset for help on using the changeset viewer.