source: patches/coreutils-6.5-id_cache-1.patch@ ceba886d

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since ceba886d was be36855, checked in by Jim Gifford <clfs@…>, 18 years ago

Update Coreutils Patch

  • Property mode set to 100644
File size: 2.5 KB
RevLine 
[be36855]1Submitted By: Jim Gifford <jim at linuxfromscratch dot org>
2Date: 2006-11-20
3Initial Package Version: 6.5
4Upstream Status: Applied
5Origin: http://lists.gnu.org/archive/html/bug-coreutils/2006-11/msg00156.html
6Description: Fixes a segfault with in ls
7
8diff -Naur coreutils-6.5.orig/lib/idcache.c coreutils-6.5/lib/idcache.c
9--- coreutils-6.5.orig/lib/idcache.c 2006-11-07 06:42:11.000000000 -0800
10+++ coreutils-6.5/lib/idcache.c 2006-11-20 23:16:09.000000000 -0800
11@@ -19,7 +19,6 @@
12
13 #include <config.h>
14
15-#include <stddef.h>
16 #include <stdio.h>
17 #include <string.h>
18 #include <sys/types.h>
19@@ -41,8 +40,8 @@
20 uid_t u;
21 gid_t g;
22 } id;
23+ char *name;
24 struct userid *next;
25- char name[FLEXIBLE_ARRAY_MEMBER];
26 };
27
28 static struct userid *user_alist;
29@@ -57,17 +56,15 @@
30 {
31 register struct userid *tail;
32 struct passwd *pwent;
33- char const *name;
34
35 for (tail = user_alist; tail; tail = tail->next)
36 if (tail->id.u == uid)
37 return tail->name;
38
39 pwent = getpwuid (uid);
40- name = pwent ? pwent->pw_name : "";
41- tail = xmalloc (offsetof (struct userid, name) + strlen (name) + 1);
42+ tail = xmalloc (sizeof *tail);
43 tail->id.u = uid;
44- strcpy (tail->name, name);
45+ tail->name = pwent ? xstrdup (pwent->pw_name) : NULL;
46
47 /* Add to the head of the list, so most recently used is first. */
48 tail->next = user_alist;
49@@ -107,8 +104,8 @@
50 }
51 #endif
52
53- tail = xmalloc (offsetof (struct userid, name) + strlen (user) + 1);
54- strcpy (tail->name, user);
55+ tail = xmalloc (sizeof *tail);
56+ tail->name = xstrdup (user);
57
58 /* Add to the head of the list, so most recently used is first. */
59 if (pwent)
60@@ -135,17 +132,15 @@
61 {
62 register struct userid *tail;
63 struct group *grent;
64- char const *name;
65
66 for (tail = group_alist; tail; tail = tail->next)
67 if (tail->id.g == gid)
68 return tail->name;
69
70 grent = getgrgid (gid);
71- name = grent ? grent->gr_name : NULL;
72- tail = xmalloc (offsetof (struct userid, name) + strlen (name) + 1);
73+ tail = xmalloc (sizeof *tail);
74 tail->id.g = gid;
75- strcpy (tail->name, name);
76+ tail->name = grent ? xstrdup (grent->gr_name) : NULL;
77
78 /* Add to the head of the list, so most recently used is first. */
79 tail->next = group_alist;
80@@ -185,8 +180,8 @@
81 }
82 #endif
83
84- tail = xmalloc (offsetof (struct userid, name) + strlen (group) + 1);
85- strcpy (tail->name, group);
86+ tail = xmalloc (sizeof *tail);
87+ tail->name = xstrdup (group);
88
89 /* Add to the head of the list, so most recently used is first. */
90 if (grent)
Note: See TracBrowser for help on using the repository browser.