diff options
Diffstat (limited to 'shadow')
-rw-r--r-- | shadow/putspent.c | 20 | ||||
-rw-r--r-- | shadow/sgetspent_r.c | 19 |
2 files changed, 19 insertions, 20 deletions
diff --git a/shadow/putspent.c b/shadow/putspent.c index 59dbfda..b638057 100644 --- a/shadow/putspent.c +++ b/shadow/putspent.c @@ -28,48 +28,48 @@ putspent (const struct spwd *p, FILE *stream) { int errors = 0; - if (fprintf (stream, "%s:%s", p->sp_namp, p->sp_pwdp) < 0) + if (fprintf (stream, "%s:%s:", p->sp_namp, p->sp_pwdp) < 0) ++errors; if ((p->sp_lstchg != (time_t) -1 - && fprintf (stream, "%ld", p->sp_lstchg) < 0) + && fprintf (stream, "%ld:", p->sp_lstchg) < 0) || (p->sp_lstchg == (time_t) -1 && putc (':', stream) == EOF)) ++errors; if ((p->sp_min != (time_t) -1 - && fprintf (stream, "%ld", p->sp_min) < 0) + && fprintf (stream, "%ld:", p->sp_min) < 0) || (p->sp_min == (time_t) -1 && putc (':', stream) == EOF)) ++errors; if ((p->sp_max != (time_t) -1 - && fprintf (stream, "%ld", p->sp_max) < 0) + && fprintf (stream, "%ld:", p->sp_max) < 0) || (p->sp_max == (time_t) -1 && putc (':', stream) == EOF)) ++errors; if ((p->sp_warn != (time_t) -1 - && fprintf (stream, "%ld", p->sp_warn) < 0) + && fprintf (stream, "%ld:", p->sp_warn) < 0) || (p->sp_warn == (time_t) -1 && putc (':', stream) == EOF)) ++errors; if ((p->sp_inact != (time_t) -1 - && fprintf (stream, "%ld", p->sp_inact) < 0) + && fprintf (stream, "%ld:", p->sp_inact) < 0) || (p->sp_inact == (time_t) -1 && putc (':', stream) == EOF)) ++errors; if ((p->sp_expire != (time_t) -1 - && fprintf (stream, "%ld", p->sp_expire) < 0) + && fprintf (stream, "%ld:", p->sp_expire) < 0) || (p->sp_expire == (time_t) -1 && putc (':', stream) == EOF)) ++errors; - if ((p->sp_flag != -1l - && fprintf (stream, "%ld", p->sp_flag) < 0) - || (p->sp_flag == -1l + if ((p->sp_flag != ~0ul + && fprintf (stream, "%ld:", p->sp_flag) < 0) + || (p->sp_flag == ~0ul && putc (':', stream) == EOF)) ++errors; diff --git a/shadow/sgetspent_r.c b/shadow/sgetspent_r.c index 134a45e..03c96b5 100644 --- a/shadow/sgetspent_r.c +++ b/shadow/sgetspent_r.c @@ -44,19 +44,18 @@ LINE_PARSER result->sp_warn = (time_t) -1; result->sp_inact = (time_t) -1; result->sp_expire = (time_t) -1; - result->sp_flag = (time_t) -1; + result->sp_flag = ~0ul; } else { - INT_FIELD (result->sp_warn, ISCOLON, 0, 10, (time_t)); - INT_FIELD (result->sp_inact, ISCOLON, 0, 10, (time_t)); - INT_FIELD (result->sp_expire, ISCOLON, 0, 10, (time_t)); - while (isspace (*line)) - ++line; - if (*line == '\0') - result->sp_flag = -1; - else - INT_FIELD (result->sp_flag, ISCOLON, 0, 10, ); + INT_FIELD_MAYBE_NULL (result->sp_warn, ISCOLON, 0, 10, (time_t), + (time_t) -1); + INT_FIELD_MAYBE_NULL (result->sp_inact, ISCOLON, 0, 10, (time_t), + (time_t) -1); + INT_FIELD_MAYBE_NULL (result->sp_expire, ISCOLON, 0, 10, (time_t), + (time_t) -1); + INT_FIELD_MAYBE_NULL (result->sp_flag, ISCOLON, 0, 10, + (unsigned long int), ~0ul); } ) |