You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So the calling code could be simplified to the following:
case 'e':
user_newexpire = strtoday (optarg);
if (user_newexpire < -1) {
fprintf (stderr,
_("%s: invalid date '%s'\n"),
Prog, optarg);
exit (E_BAD_ARG);
}
user_newexpire *= DAY / SCALE;
eflg = true;
break;
There are 2 versions of strtoday() (actually 3), and at first I thought that the old ones might not handle correctly the special case. However, I found what could be a bug, which I think would handle "" correctly by accident. Instead of returning -2 on error, the old functions return -1, and since they don't handle "" specially, they will report an error. Since -1 is handled not as an error but as a 'never' by the calling code, it would work.
I'll send a pull request soon and link to this issue.
The text was updated successfully, but these errors were encountered:
In parsing the argument to the
--expiredate
option, there's a special case for""
:shadow/src/usermod.c
Line 1076 in 7687ae4
However, (the new version of)
strtoday()
already handles that special case:shadow/libmisc/strtoday.c
Line 77 in 7687ae4
So the calling code could be simplified to the following:
There are 2 versions of
strtoday()
(actually 3), and at first I thought that the old ones might not handle correctly the special case. However, I found what could be a bug, which I think would handle""
correctly by accident. Instead of returning -2 on error, the old functions return -1, and since they don't handle""
specially, they will report an error. Since-1
is handled not as an error but as a 'never' by the calling code, it would work.I'll send a pull request soon and link to this issue.
The text was updated successfully, but these errors were encountered: