diff options
author | Russ Allbery <rra@stanford.edu> | 2013-02-27 14:21:48 -0800 |
---|---|---|
committer | Russ Allbery <rra@stanford.edu> | 2013-02-27 16:52:13 -0800 |
commit | 7a572127a7305a17bf84c26e66e65ab37f66b77d (patch) | |
tree | 60d9763a420a67f7c28a60b03e6665a03d2b18ee | |
parent | 54715c37f1649b88d52806e1ad4b30e32c6f816e (diff) |
Check for errors when renaming new keytab
When linking the temporary keytab to its final file name, wallet wasn't
checking for errors. Caught by the new gcc warnings.
Change-Id: Ia75b231754bafc800e9e521345b85da256c95ed1
Reviewed-on: https://gerrit.stanford.edu/840
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
-rw-r--r-- | client/keytab.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/client/keytab.c b/client/keytab.c index 9a7734e..6614c4b 100644 --- a/client/keytab.c +++ b/client/keytab.c @@ -252,9 +252,11 @@ rekey_keytab(struct remctl *r, krb5_context ctx, const char *type, * keys. If there is an error, first make a backup of the current keytab * file as keytab.old. */ - if (access(file, F_OK) != 0) - link(tempfile, file); - else { + if (access(file, F_OK) != 0) { + if (link(tempfile, file) < 0) + sysdie("rename of temporary keytab %s to %s failed", tempfile, + file); + } else { if (error) { data = read_file(file, &length); backupfile = concat(file, ".old", (char *) 0); |