From 04f3cd273729cdb121e8340cc72d1e969d18cdd0 Mon Sep 17 00:00:00 2001 From: Barry Jaspan Date: Sun, 1 Jul 1990 15:21:12 +0000 Subject: [PATCH] error isntead of -1; changed "Errors:" to include system errors from open bjaspan: forced ticket cache file to be mode 0600; returns errno on open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1011 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/ccache/file/fcc_gennew.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/krb5/ccache/file/fcc_gennew.c b/src/lib/krb5/ccache/file/fcc_gennew.c index 7772d336f..8db6419f8 100644 --- a/src/lib/krb5/ccache/file/fcc_gennew.c +++ b/src/lib/krb5/ccache/file/fcc_gennew.c @@ -32,6 +32,7 @@ extern krb5_cc_ops krb5_fcc_ops; * Errors: * KRB5_NOMEM - there was insufficient memory to allocate the * krb5_ccache. id is undefined. + * system errors (from open) */ krb5_error_code krb5_fcc_generate_new (id) @@ -71,10 +72,12 @@ krb5_fcc_generate_new (id) strcpy(((krb5_fcc_data *) lid->data)->filename, scratch); /* Make sure the file name is reserved */ - ret = open(((krb5_fcc_data *) lid->data)->filename, O_CREAT| O_EXCL,0600); + ret = open(((krb5_fcc_data *) lid->data)->filename, O_CREAT | O_EXCL, 0); if (ret == -1) - return ret; + return errno; else { + /* Ignore user's umask, set mode = 0600 */ + fchmod(ret, S_IREAD | S_IWRITE); close(ret); *id = lid; return KRB5_OK; -- 2.26.2