diff options
author | Mattias Andrée <maandree@kth.se> | 2023-06-23 11:38:50 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2023-06-23 11:38:50 +0200 |
commit | e3556481ede823ec6b52065a832232fffd24b765 (patch) | |
tree | 0513080e9e7f3960a05a10d8a6a5ccde7f617c75 /key2root-lskeys.c | |
parent | Add argument checks to key2root-addkey and key2root-rmkey (diff) | |
download | key2root-e3556481ede823ec6b52065a832232fffd24b765.tar.gz key2root-e3556481ede823ec6b52065a832232fffd24b765.tar.bz2 key2root-e3556481ede823ec6b52065a832232fffd24b765.tar.xz |
Fix minor mistakes i key2root-lskeys.c, implement key2root-rmkey.c, and minor work on key2root-addkey.c
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | key2root-lskeys.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/key2root-lskeys.c b/key2root-lskeys.c index 7dee003..69e6319 100644 --- a/key2root-lskeys.c +++ b/key2root-lskeys.c @@ -91,7 +91,7 @@ listkeys(int dir, const char *user) } } r = read(fd, &data[whead], size - whead); - if (r <= 0) { + if (r < 0) { fprintf(stderr, "%s: read /etc/key2root/%s: %s\n", argv0, user, strerror(errno)); close(fd); return 1; @@ -102,8 +102,10 @@ listkeys(int dir, const char *user) failed |= outputkey(data, whead, &rhead, &rhead2, &lineno, user); } - if (rhead != whead) + if (rhead != whead) { fprintf(stderr, "%s: file truncated: /etc/key2root/%s\n", argv0, user); + failed = 1; + } close(fd); return failed; |