diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/util/profile/ChangeLog | 8 | ||||
| -rw-r--r-- | src/util/profile/prof_err.et | 1 | ||||
| -rw-r--r-- | src/util/profile/prof_file.c | 12 |
3 files changed, 19 insertions, 2 deletions
diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog index b54fe058e..835a00b59 100644 --- a/src/util/profile/ChangeLog +++ b/src/util/profile/ChangeLog @@ -1,3 +1,11 @@ +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 diff --git a/src/util/profile/prof_err.et b/src/util/profile/prof_err.et index 410bdc6a5..e6e35db0a 100644 --- a/src/util/profile/prof_err.et +++ b/src/util/profile/prof_err.et @@ -47,6 +47,7 @@ error_code PROF_NO_PROFILE, "No profile file open" # 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 diff --git a/src/util/profile/prof_file.c b/src/util/profile/prof_file.c index 3bdb5d6f3..fe9137afd 100644 --- a/src/util/profile/prof_file.c +++ b/src/util/profile/prof_file.c @@ -125,9 +125,14 @@ errcode_t profile_update_file(prf) 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)) @@ -166,9 +171,12 @@ errcode_t profile_flush_file(prf) 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; } |
