From eeb4f1206bc747d142b135a03bccdf674623262a Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 20 Sep 2019 20:39:03 +0100 Subject: [PATCH] Fix installation of locales-all 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 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c index e6310b18b..e646889d1 100644 --- a/locale/programs/locarchive.c +++ b/locale/programs/locarchive.c @@ -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); -- 2.30.2