Fix installation of locales-all
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Wed, 5 Dec 2018 18:50:21 +0000 (18:50 +0000)
committerAurelien Jarno <aurel32@debian.org>
Wed, 5 Dec 2018 18:50:21 +0000 (18:50 +0000)
Dirty hack to fix installation of locales-all: instead of just locking the
archive extension (which is not supported on hurd-i386), lock it all.

Gbp-Pq: Topic hurd-i386
Gbp-Pq: Name tg-locarchive.diff

locale/programs/locarchive.c

index ca332a345fc8c92da09d787dc77aa4795f7bef4e..e91323e1d14cc1e43f2df81e5ccaaa209a3753c0 100644 (file)
@@ -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);