From: Andre Noll <maan@systemlinux.org>
Date: Fri, 6 Jun 2008 12:22:42 +0000 (+0200)
Subject: Kill E_OSL_TRUNC.
X-Git-Tag: v0.1.0~59
X-Git-Url: https://git.tue.mpg.de/?a=commitdiff_plain;h=dfd3368c03d72660b1e5dba55b23395e234d0963;p=osl.git

Kill E_OSL_TRUNC.
---

diff --git a/errlist b/errlist
index 0870bca..06e2e80 100644
--- 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
--- 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;
 }
-