summaryrefslogtreecommitdiff
path: root/locale/programs/locarchive.c
diff options
context:
space:
mode:
Diffstat (limited to 'locale/programs/locarchive.c')
-rw-r--r--locale/programs/locarchive.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index 88e1172219..ff4b32e0d2 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -453,7 +453,16 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
}
/* Lock the new file. */
+#ifdef __GNU__
+ struct flock fl;
+ fl.l_whence = SEEK_SET;
+ fl.l_start = 0;
+ fl.l_len = 0;
+ fl.l_type = F_WRLCK;
+ if (fcntl(fd, F_SETLKW, &fl) != 0)
+#else
if (lockf64 (fd, F_LOCK, total) != 0)
+#endif
{
int errval = errno;
unlink (fname);
@@ -613,7 +622,16 @@ open_archive (struct locarhandle *ah, bool readonly)
error (EXIT_FAILURE, errno, _("cannot stat locale archive \"%s\""),
archivefname);
+#ifdef __GNU__
+ struct flock fl;
+ fl.l_whence = SEEK_SET;
+ fl.l_start = 0;
+ fl.l_len = 0;
+ fl.l_type = F_WRLCK;
+ if (!readonly && fcntl(fd, F_SETLKW, &fl) == -1)
+#else
if (!readonly && lockf64 (fd, F_LOCK, sizeof (struct locarhead)) == -1)
+#endif
{
close (fd);