/* Test userspec.c
- Copyright (C) 2009-2010 Free Software Foundation, Inc.
+ Copyright (C) 2009-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
char *user_name;
char *group_name;
char const *diag = parse_user_spec (T[i].in, &uid, &gid,
- &user_name, &group_name);
+ &user_name, &group_name);
free (user_name);
free (group_name);
if (!same_diag (diag, T[i].result))
if (uid != T[i].uid || gid != T[i].gid)
{
printf ("%s mismatch (-: expected uid,gid; +:actual)\n"
- "-%3lu,%3lu\n+%3lu,%3lu\n",
- T[i].in,
+ "-%3lu,%3lu\n+%3lu,%3lu\n",
+ T[i].in,
(unsigned long int) T[i].uid,
(unsigned long int) T[i].gid,
(unsigned long int) uid,
{
printf ("%s diagnostic mismatch (-: expected uid,gid; +:actual)\n"
- "-%s\n+%s\n",
- T[i].in, T[i].result, diag);
+ "-%s\n+%s\n",
+ T[i].in, T[i].result, diag);
fail = 1;
}
}
+ /* Ensure NULL parameters are ignored. */
+ {
+ uid_t uid = (uid_t) -1;
+ char const *diag = parse_user_spec ("", &uid, NULL, NULL, NULL);
+ if (diag)
+ {
+ printf ("unexpected error: %s\n", diag);
+ fail = 1;
+ }
+ }
+
return fail;
}