X-Git-Url: http://git.tuebingen.mpg.de/?p=osl.git;a=blobdiff_plain;f=util.c;fp=util.c;h=79b49445d7c602601e4b18e00ee99450dd5bc2c9;hp=7bf74b0b2dc099c066e8e0dd96d93a47cb01fbd5;hb=e2950383a28766d521a69ec5660b8271f322cbdb;hpb=06fa6acd87ac23ee3ca422dbc56cf97a3c71aa09 diff --git a/util.c b/util.c index 7bf74b0..79b4944 100644 --- a/util.c +++ b/util.c @@ -40,7 +40,7 @@ static ssize_t __write(int fd, const void *buf, size_t size) ret = write(fd, buf, size); if ((ret < 0) && (errno == EAGAIN || errno == EINTR)) continue; - return ret >= 0? ret : -ERRNO_TO_ERROR(errno); + return ret >= 0? ret : -E_OSL_WRITE; } } @@ -89,7 +89,7 @@ int osl_open(const char *path, int flags, mode_t mode) if (ret >= 0) return ret; - return -ERRNO_TO_ERROR(errno); + return -E_OSL_OPEN; } /** @@ -153,7 +153,7 @@ int mmap_full_file(const char *path, int open_mode, void **map, return ret; fd = ret; if (fstat(fd, &file_status) < 0) { - ret = -ERRNO_TO_ERROR(errno); + ret = -E_OSL_FSTAT; goto out; } *size = file_status.st_size; @@ -194,7 +194,7 @@ int osl_munmap(void *start, size_t length) err = errno; ERROR_LOG("munmap (%p/%zu) failed: %s\n", start, length, strerror(err)); - return -ERRNO_TO_ERROR(err); + return -E_OSL_MUNMAP; } /** @@ -267,6 +267,6 @@ int truncate_file(const char *path, off_t size) if (statbuf.st_size < size) return ret; if (truncate(path, statbuf.st_size - size) < 0) - return -ERRNO_TO_ERROR(errno); + return -E_OSL_TRUNCATE; return 1; }