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 0870bcad4b08300544044141ea802efec10942e3..06e2e808d4272c1eb369c745f6e093f046e85e52 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 cd5232caf1339a61ae8d9a397395fe07214b6892..7d69a2f35b6fb3fe08ce487b6c02d3ebe557c9f2 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;
 }
-