Kill all users of ERRNO_TO_ERROR() in util.c and util.h.
[osl.git] / util.c
diff --git a/util.c b/util.c
index 7bf74b0b2dc099c066e8e0dd96d93a47cb01fbd5..79b49445d7c602601e4b18e00ee99450dd5bc2c9 100644 (file)
--- 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;
 }