summaryrefslogtreecommitdiffstats
path: root/src/credmonger.c
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2009-04-01 23:47:32 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2009-04-01 23:47:32 -0400
commit54607e80544c9c39983bb48951a3363adf3c24ba (patch)
treee0ec04acb03183a4ba4f28429d7da1184d26e2be /src/credmonger.c
parentc62a16822f75e81f51b230d1cb550c7410ac4461 (diff)
downloadcredmonger-54607e80544c9c39983bb48951a3363adf3c24ba.tar.gz
credmonger-54607e80544c9c39983bb48951a3363adf3c24ba.tar.xz
credmonger-54607e80544c9c39983bb48951a3363adf3c24ba.zip
- add a sample file
- return an error in a few more error cases - tweak the .spec file
Diffstat (limited to 'src/credmonger.c')
-rw-r--r--src/credmonger.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/credmonger.c b/src/credmonger.c
index 488e3a6..e622646 100644
--- a/src/credmonger.c
+++ b/src/credmonger.c
@@ -426,8 +426,13 @@ entries_poll(void)
/* Done with the ccache structure. */
krb5_cc_close(ctx, ccache);
/* Fixup permissions. */
- chown(fccache + strlen(FCC_PREFIX),
- entries[i]->uid, entries[i]->gid);
+ if (chown(fccache + strlen(FCC_PREFIX),
+ entries[i]->uid, entries[i]->gid) != 0) {
+ fprintf(stderr, "error setting permissions "
+ "on \"%s\": %s\n",
+ fccache + strlen(FCC_PREFIX),
+ strerror(errno));
+ }
/* If the configuration doesn't want a unique ccache
* name, overwrite the destination with the contents of
* this temporary file. */
@@ -583,10 +588,15 @@ main(int argc, char **argv)
entries = entries_read();
if (entries == NULL) {
fprintf(stderr, "nothing configured\n");
+ return 1;
}
if (!nofork) {
- daemon(0, 0);
+ if (daemon(0, 0) != 0) {
+ fprintf(stderr, "error going to background: %s\n",
+ strerror(errno));
+ return 1;
+ }
}
fp = fopen(pidfile, "w");