aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2002-10-23 21:39:27 +0000
committerBruce Momjian <bruce@momjian.us>2002-10-23 21:39:27 +0000
commit586510f774d7d03bbb2acd344ada6a5bf888e76b (patch)
treee237e0795baf04b06cda16ebc11a230a1a3b1a76
parent6b9d496988f143553d4226a81651154aa7a1e1ed (diff)
downloadpostgresql-586510f774d7d03bbb2acd344ada6a5bf888e76b.tar.gz
postgresql-586510f774d7d03bbb2acd344ada6a5bf888e76b.zip
Improve coding style of new function.
-rw-r--r--src/port/fseeko.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/port/fseeko.c b/src/port/fseeko.c
index 60a0ae41029..dd4ef324718 100644
--- a/src/port/fseeko.c
+++ b/src/port/fseeko.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/port/fseeko.c,v 1.2 2002/10/23 21:16:17 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/port/fseeko.c,v 1.3 2002/10/23 21:39:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,16 +40,10 @@ fseeko(FILE *stream, off_t offset, int whence)
case SEEK_CUR:
flockfile(stream);
if (fgetpos(stream, &floc) != 0)
- {
- funlockfile(stream);
- return -1;
- }
+ goto failure;
floc += offset;
if (fsetpos(stream, &floc) != 0)
- {
- funlockfile(stream);
- return -1;
- }
+ goto failure;
flockfile(stream);
return 0;
break;
@@ -61,16 +55,10 @@ fseeko(FILE *stream, off_t offset, int whence)
case SEEK_END:
flockfile(stream);
if (fstat(fileno(stream), &filestat) != 0)
- {
- funlockfile(stream);
- return -1;
- }
+ goto failure;
floc = filestat.st_size;
if (fsetpos(stream, &floc) != 0)
- {
- funlockfile(stream);
- return -1;
- }
+ goto failure;
funlockfile(stream);
return 0;
break;
@@ -78,6 +66,10 @@ fseeko(FILE *stream, off_t offset, int whence)
errno = EINVAL;
return -1;
}
+
+failure:
+ funlockfile(stream);
+ return -1;
}