comparison lib/idcache.c @ 12421:e8d2c6fc33ad

Use spaces for indentation, not tabs.
author Bruno Haible <bruno@clisp.org>
date Thu, 10 Dec 2009 20:28:30 +0100
parents bbbbbf4cd1c5
children b5e42ef33b49
comparison
equal deleted inserted replaced
12420:5850b9a81029 12421:e8d2c6fc33ad
71 struct userid *match = NULL; 71 struct userid *match = NULL;
72 72
73 for (tail = user_alist; tail; tail = tail->next) 73 for (tail = user_alist; tail; tail = tail->next)
74 { 74 {
75 if (tail->id.u == uid) 75 if (tail->id.u == uid)
76 { 76 {
77 match = tail; 77 match = tail;
78 break; 78 break;
79 } 79 }
80 } 80 }
81 81
82 if (match == NULL) 82 if (match == NULL)
83 { 83 {
84 struct passwd *pwent = getpwuid (uid); 84 struct passwd *pwent = getpwuid (uid);
121 /* We need to pretend to be the user USER, to make 121 /* We need to pretend to be the user USER, to make
122 pwd functions know about an arbitrary user name. */ 122 pwd functions know about an arbitrary user name. */
123 if (!pwent && strspn (user, digits) < strlen (user)) 123 if (!pwent && strspn (user, digits) < strlen (user))
124 { 124 {
125 setenv ("USER", user, 1); 125 setenv ("USER", user, 1);
126 pwent = getpwnam (user); /* now it will succeed */ 126 pwent = getpwnam (user); /* now it will succeed */
127 } 127 }
128 #endif 128 #endif
129 129
130 tail = xmalloc (offsetof (struct userid, name) + strlen (user) + 1); 130 tail = xmalloc (offsetof (struct userid, name) + strlen (user) + 1);
131 strcpy (tail->name, user); 131 strcpy (tail->name, user);
153 struct userid *match = NULL; 153 struct userid *match = NULL;
154 154
155 for (tail = group_alist; tail; tail = tail->next) 155 for (tail = group_alist; tail; tail = tail->next)
156 { 156 {
157 if (tail->id.g == gid) 157 if (tail->id.g == gid)
158 { 158 {
159 match = tail; 159 match = tail;
160 break; 160 break;
161 } 161 }
162 } 162 }
163 163
164 if (match == NULL) 164 if (match == NULL)
165 { 165 {
166 struct group *grent = getgrgid (gid); 166 struct group *grent = getgrgid (gid);
203 /* We need to pretend to belong to group GROUP, to make 203 /* We need to pretend to belong to group GROUP, to make
204 grp functions know about an arbitrary group name. */ 204 grp functions know about an arbitrary group name. */
205 if (!grent && strspn (group, digits) < strlen (group)) 205 if (!grent && strspn (group, digits) < strlen (group))
206 { 206 {
207 setenv ("GROUP", group, 1); 207 setenv ("GROUP", group, 1);
208 grent = getgrnam (group); /* now it will succeed */ 208 grent = getgrnam (group); /* now it will succeed */
209 } 209 }
210 #endif 210 #endif
211 211
212 tail = xmalloc (offsetof (struct userid, name) + strlen (group) + 1); 212 tail = xmalloc (offsetof (struct userid, name) + strlen (group) + 1);
213 strcpy (tail->name, group); 213 strcpy (tail->name, group);