om

om - the most recently modified file in a directory
git clone git://git.larryhynes.net/om
Log | Files | Refs | README | LICENSE

commit 0721c39424ae5e56026026e8f1d78829afdb1316
parent 0d08b12d6e5e1d5a14e63126257ac0ba77490481
Author: Larry Hynes <larry@larryhynes.com>
Date:   Wed,  5 Jul 2017 10:45:19 +0100

Leave '...name too long' errx msgs in place

On balance, I think this is less ugly than having a separate serr(),
but it's still annoying.

Diffstat:
om.c | 12+++---------
1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/om.c b/om.c @@ -39,12 +39,6 @@ char } void -serr() -{ - errx(1, "Path name too long"); -} - -void om() { DIR *dirp; @@ -62,13 +56,13 @@ om() while ((ent = readdir(dirp)) != NULL) { len = strlcpy(buf, dir, sizeof(buf)); if (len >= sizeof(buf)) - serr(); + errx(1, "Path name too long"); len = strlcat(buf, "/", sizeof(buf)); if (len >= sizeof(buf)) - serr(); + errx(1, "Path name too long"); len = strlcat(buf, ent->d_name, sizeof(buf)); if (len >= sizeof(buf)) - serr(); + errx(1, "Path name too long"); stat(buf, &sb);