Replace underscores with dashes in fsck command line options.
[osl.git] / util.c
diff --git a/util.c b/util.c
index 7500c08b2a6f085f4acc4fc77efc985a4351d977..db80854203728d50081c98fe128e6c5d6c22b3ae 100644 (file)
--- a/util.c
+++ b/util.c
@@ -61,8 +61,10 @@ int write_all(int fd, const char *buf, size_t *len)
        *len = 0;
        while (*len < total) {
                int ret = __write(fd, buf + *len, total - *len);
-               if (ret < 0)
+               if (ret < 0) {
+                       ERROR_LOG("write error: %s\n", strerror(errno));
                        return ret;
+               }
                *len += ret;
        }
        return 1;
@@ -88,7 +90,7 @@ int osl_open(const char *path, int flags, mode_t mode)
 
        if (ret >= 0)
                return ret;
-       return -E_OSL_OPEN;
+       return errno == ENOENT? -E_OSL_NOENT : -E_OSL_OPEN;
 }
 
 /**
@@ -152,7 +154,7 @@ int mmap_full_file(const char *path, int open_mode, void **map,
                return ret;
        fd = ret;
        if (fstat(fd, &file_status) < 0) {
-               ret = -E_OSL_FSTAT;
+               ret = errno == ENOENT? -E_OSL_NOENT : -E_OSL_STAT;
                goto out;
        }
        *size = file_status.st_size;