X-Git-Url: http://git.tuebingen.mpg.de/?p=osl.git;a=blobdiff_plain;f=util.h;h=70beae4d657c626963935a7c0406bd9a2084443d;hp=2e3c66fcf0214e5bb2b098d02cfce5758e5500e4;hb=3448f4caccded0a60aa5f81976cd8c285908e7bb;hpb=c1a4bb030717f2d2d209ccd8ab898ab66fa16869 diff --git a/util.h b/util.h index 2e3c66f..70beae4 100644 --- a/util.h +++ b/util.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Andre Noll + * Copyright (C) 2006-2009 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -26,7 +26,7 @@ static inline int osl_mkdir(const char *path, mode_t mode) { if (!mkdir(path, mode)) return 1; - return -ERRNO_TO_ERROR(errno); + return errno == EEXIST? -E_OSL_DIR_EXISTS : -E_OSL_MKDIR; } /** @@ -42,7 +42,7 @@ static inline int osl_mkdir(const char *path, mode_t mode) _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 -E_OSL_RENAME; return 1; } @@ -50,5 +50,5 @@ _static_inline_ int osl_stat(const char *path, struct stat *buf) { if (stat(path, buf) >= 0) return 1; - return -ERRNO_TO_ERROR(errno); + return errno == ENOENT? -E_OSL_NOENT : -E_OSL_STAT; }