File: tg-locarchive.diff

package info (click to toggle)
glibc 2.24-10
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 223,412 kB
  • sloc: ansic: 991,967; asm: 261,800; sh: 10,385; makefile: 9,710; cpp: 4,169; python: 3,971; perl: 2,254; awk: 1,753; pascal: 1,521; yacc: 291; sed: 80
file content (46 lines) | stat: -rw-r--r-- 1,261 bytes parent folder | download | duplicates (18)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
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.

---
 locale/programs/locarchive.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -453,7 +453,16 @@ enlarge_archive (struct locarhandle *ah,
     }
 
   /* 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, bo
 	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);