Kill E_OSL_TRUNC.
authorAndre Noll <maan@systemlinux.org>
Fri, 6 Jun 2008 12:22:42 +0000 (14:22 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 6 Jun 2008 12:22:42 +0000 (14:22 +0200)
errlist
fd.c

diff --git a/errlist b/errlist
index 0870bca..06e2e80 100644 (file)
--- a/errlist
+++ b/errlist
@@ -15,7 +15,6 @@ BAD_DATA_SIZE                 "wrong data size for fixed-size column"
 NOT_MAPPED                     "file not mapped"
 ALREADY_MAPPED                 "file already mapped"
 BAD_SIZE                       "invalid size specified"
-TRUNC                          "failed to truncate file"
 BAD_TABLE                      "table not open"
 BAD_TABLE_DESC                 "invalid table description"
 RB_KEY_EXISTS                  "key already exists in rbtree"
diff --git a/fd.c b/fd.c
index cd5232c..7d69a2f 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -342,15 +342,11 @@ int truncate_file(const char *path, off_t size)
 
        ret = osl_stat(path, &statbuf);
        if (ret < 0)
-               goto out;
+               return ret;
        ret = -E_OSL_BAD_SIZE;
        if (statbuf.st_size < size)
-               goto out;
-       ret = -E_OSL_TRUNC;
+               return ret;
        if (truncate(path, statbuf.st_size - size) < 0)
-               goto out;
-       ret = 1;
-out:
-       return ret;
+               return -ERRNO_TO_ERROR(errno);
+       return 1;
 }
-