diff options
Diffstat (limited to '')
-rw-r--r-- | lib/hushed.c (renamed from libmisc/hushed.c) | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libmisc/hushed.c b/lib/hushed.c index 84b2f55..86c224f 100644 --- a/libmisc/hushed.c +++ b/lib/hushed.c @@ -18,6 +18,9 @@ #include "defines.h" #include "prototypes.h" #include "getdef.h" +#include "string/sprintf.h" + + /* * hushed - determine if a user receives login messages * @@ -26,11 +29,11 @@ */ bool hushed (const char *username) { - struct passwd *pw; - const char *hushfile; - char buf[BUFSIZ]; - bool found; - FILE *fp; + bool found; + char buf[BUFSIZ]; + FILE *fp; + const char *hushfile; + struct passwd *pw; /* * Get the name of the file to use. If this option is not @@ -53,7 +56,7 @@ bool hushed (const char *username) */ if (hushfile[0] != '/') { - (void) snprintf (buf, sizeof (buf), "%s/%s", pw->pw_dir, hushfile); + SNPRINTF(buf, "%s/%s", pw->pw_dir, hushfile); return (access (buf, F_OK) == 0); } @@ -66,7 +69,7 @@ bool hushed (const char *username) if (NULL == fp) { return false; } - for (found = false; !found && (fgets (buf, (int) sizeof buf, fp) == buf);) { + for (found = false; !found && (fgets (buf, sizeof buf, fp) == buf);) { buf[strcspn (buf, "\n")] = '\0'; found = (strcmp (buf, pw->pw_shell) == 0) || (strcmp (buf, pw->pw_name) == 0); |