X-Git-Url: http://git.tuebingen.mpg.de/?p=osl.git;a=blobdiff_plain;f=fd.h;h=bb09eb3eb3d0ecafd1a71cc49c579b5e8a0f7c1f;hp=55f1cacb6897c7012aa342eb1130449e3b5e2109;hb=f20ee31e76615776f4b56d57a3a4fc1919de2914;hpb=093138ba762b3179f4d0375bbaf4250b9e016289 diff --git a/fd.h b/fd.h index 55f1cac..bb09eb3 100644 --- a/fd.h +++ b/fd.h @@ -28,3 +28,19 @@ static inline int osl_mkdir(const char *path, mode_t mode) return -ERRNO_TO_ERROR(errno); } +/** + * A wrapper for rename(2). + * + * \param old_path The source path. + * \param new_path The destination path. + * + * \return Standard. + * + * \sa rename(2). + */ +_static_inline_ int osl_rename(const char *old_path, const char *new_path) +{ + if (rename(old_path, new_path) < 0) + return -ERRNO_TO_ERROR(errno); + return 1; +}