X-Git-Url: http://git.tuebingen.mpg.de/?p=osl.git;a=blobdiff_plain;f=util.c;h=49f1914e81e59a2648a9cb9af364ad1d98ac58cd;hp=79b49445d7c602601e4b18e00ee99450dd5bc2c9;hb=f0884471639e04bda513bb5a9055d5c00d8c4533;hpb=e2950383a28766d521a69ec5660b8271f322cbdb diff --git a/util.c b/util.c index 79b4944..49f1914 100644 --- a/util.c +++ b/util.c @@ -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. */ @@ -14,7 +14,6 @@ #include "log.h" #include "osl.h" -#include "error.h" #include "util.h" /** @@ -62,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; @@ -89,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; } /** @@ -153,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;