[hackers] [sbase] ls: LEN(pw|grname) -> sizeof() || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Wed, 30 Sep 2015 20:44:17 +0200 (CEST)

commit 874d131728d5ae00a1ed5246cc4eecbaa839029d
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
AuthorDate: Sun Sep 6 22:35:14 2015 +0200
Commit: sin <sin_AT_2f30.org>
CommitDate: Wed Sep 30 19:44:10 2015 +0100

    ls: LEN(pw|grname) -> sizeof()

diff --git a/ls.c b/ls.c
index 427ada3..5f43f37 100644
--- a/ls.c
+++ b/ls.c
_AT_@ -175,14 +175,14 @@ output(const struct entry *ent)
         if (ent->mode & S_ISVTX) mode[9] = (mode[9] == 'x') ? 't' : 'T';
 
         if (!nflag && (pw = getpwuid(ent->uid)))
- snprintf(pwname, LEN(pwname), "%s", pw->pw_name);
+ snprintf(pwname, sizeof(pwname), "%s", pw->pw_name);
         else
- snprintf(pwname, LEN(pwname), "%d", ent->uid);
+ snprintf(pwname, sizeof(pwname), "%d", ent->uid);
 
         if (!nflag && (gr = getgrgid(ent->gid)))
- snprintf(grname, LEN(grname), "%s", gr->gr_name);
+ snprintf(grname, sizeof(grname), "%s", gr->gr_name);
         else
- snprintf(grname, LEN(grname), "%d", ent->gid);
+ snprintf(grname, sizeof(grname), "%d", ent->gid);
 
         if (time(NULL) > ent->t + (180 * 24 * 60 * 60)) /* 6 months ago? */
                 fmt = "%b %d %Y";
Received on Wed Sep 30 2015 - 20:44:17 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 30 2015 - 20:48:15 CEST