set errno when fopen fails to open a file. Work around this by
setting errno to PROF_FAIL_OPEN in this case.
prof_err.et: Add new error code PROF_FAIL_OPEN.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11238
dc483132-0cff-0310-8789-
dd5450dbe970
+Wed Mar 3 18:23:47 1999 Theodore Y. Ts'o <tytso@mit.edu>
+
+ * prof_file.c (profile_flush_file): On the Macintosh, fopen()
+ doesn't set errno when fopen fails to open a file. Work
+ around this by setting errno to PROF_FAIL_OPEN in this case.
+
+ * prof_err.et: Add new error code PROF_FAIL_OPEN.
+
Tue Mar 2 18:55:50 1999 Theodore Y. Ts'o <tytso@mit.edu>
* test_profile.c: Added ability to test profile set functions, and
# generated by prof_file.c
#
error_code PROF_MAGIC_FILE, "Bad magic value in profile_file_t"
+error_code PROF_FAIL_OPEN, "Couldn't open profile file"
#
# generated by prof_set.c
if (prf->root)
return 0;
#endif
+ errno = 0;
f = fopen(prf->filename, "r");
- if (f == NULL)
- return errno;
+ if (f == NULL) {
+ retval = errno;
+ if (retval == 0)
+ retval = PROF_FAIL_OPEN;
+ return retval;
+ }
prf->upd_serial++;
prf->flags = 0;
if (rw_access(prf->filename))
sprintf(new_name, "%s.$$$", prf->filename);
sprintf(old_name, "%s.bak", prf->filename);
+ errno = 0;
f = fopen(new_name, "w");
if (!f) {
retval = errno;
+ if (retval == 0)
+ retval = PROF_FAIL_OPEN;
goto errout;
}