summaryrefslogtreecommitdiff
path: root/pwd
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2005-07-18 04:41:16 +0000
committerRoland McGrath <roland@gnu.org>2005-07-18 04:41:16 +0000
commit7a85da437bd49afd827c41474677c3904cf7ce3e (patch)
tree8ab56107960fcc0f3a2cf39f2eef07aadc180e1a /pwd
parentefe36102b1d423e82e94217e069460134cde5687 (diff)
Updated to fedora-glibc-2_3-20050718T0425
Diffstat (limited to 'pwd')
-rw-r--r--pwd/putpwent.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/pwd/putpwent.c b/pwd/putpwent.c
index 8b7767bd4a..a265719d36 100644
--- a/pwd/putpwent.c
+++ b/pwd/putpwent.c
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <pwd.h>
-#define _S(x) x ? x : ""
+#define _S(x) x ?: ""
/* Write an entry to the given stream.
This must know the format of the password file. */
@@ -35,11 +35,21 @@ putpwent (p, stream)
return -1;
}
- if (fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
- p->pw_name, _S (p->pw_passwd),
- (unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
- _S (p->pw_gecos), _S (p->pw_dir), _S (p->pw_shell)) < 0)
- return -1;
-
+ if (p->pw_name[0] == '+' || p->pw_name[0] == '-')
+ {
+ if (fprintf (stream, "%s:%s:::%s:%s:%s\n",
+ p->pw_name, _S (p->pw_passwd),
+ _S (p->pw_gecos), _S (p->pw_dir), _S (p->pw_shell)) < 0)
+ return -1;
+ }
+ else
+ {
+ if (fprintf (stream, "%s:%s:%lu:%lu:%s:%s:%s\n",
+ p->pw_name, _S (p->pw_passwd),
+ (unsigned long int) p->pw_uid,
+ (unsigned long int) p->pw_gid,
+ _S (p->pw_gecos), _S (p->pw_dir), _S (p->pw_shell)) < 0)
+ return -1;
+ }
return 0;
}