aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2003-01-11 19:38:23 +0000
committerBruce Momjian <bruce@momjian.us>2003-01-11 19:38:23 +0000
commitbb6652552a422abee68858446ae665a5594c92b6 (patch)
treef9831ee780c167a743a4c2b6d4023886821ec868
parent43057c7a276a63ad853eb2fcc5074487bd321539 (diff)
downloadpostgresql-bb6652552a422abee68858446ae665a5594c92b6.tar.gz
postgresql-bb6652552a422abee68858446ae665a5594c92b6.zip
Back out flockfile change for NetBSD. Giles Lean reports they are not
supported.
-rw-r--r--src/port/fseeko.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/port/fseeko.c b/src/port/fseeko.c
index fd652e1508a..79a680f383b 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.9 2003/01/02 23:22:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/port/fseeko.c,v 1.10 2003/01/11 19:38:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,7 +21,9 @@
#include "c.h"
+#ifdef bsdi
#include <pthread.h>
+#endif
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -44,13 +46,17 @@ fseeko(FILE *stream, off_t offset, int whence)
switch (whence)
{
case SEEK_CUR:
+#ifdef bsdi
flockfile(stream);
+#endif
if (fgetpos(stream, &floc) != 0)
goto failure;
floc += offset;
if (fsetpos(stream, &floc) != 0)
goto failure;
+#ifdef bsdi
funlockfile(stream);
+#endif
return 0;
break;
case SEEK_SET:
@@ -59,13 +65,17 @@ fseeko(FILE *stream, off_t offset, int whence)
return 0;
break;
case SEEK_END:
+#ifdef bsdi
flockfile(stream);
+#endif
if (fstat(fileno(stream), &filestat) != 0)
goto failure;
floc = filestat.st_size;
if (fsetpos(stream, &floc) != 0)
goto failure;
+#ifdef bsdi
funlockfile(stream);
+#endif
return 0;
break;
default:
@@ -74,7 +84,9 @@ fseeko(FILE *stream, off_t offset, int whence)
}
failure:
+#ifdef bsdi
funlockfile(stream);
+#endif
return -1;
}