diff options
author | Jeffrey Altman <jaltman@secure-endpoints.com> | 1999-07-23 03:28:05 +0000 |
---|---|---|
committer | Jeffrey Altman <jaltman@secure-endpoints.com> | 1999-07-23 03:28:05 +0000 |
commit | bb0718a30700e86dc2b69748b0af4521d59a93da (patch) | |
tree | 42acea1795cdf01003d63981ce82329ae4a1144e /src/util/profile | |
parent | 825128ac38f51df74659c43b70369814a1ae2eff (diff) | |
download | krb5-bb0718a30700e86dc2b69748b0af4521d59a93da.tar.gz krb5-bb0718a30700e86dc2b69748b0af4521d59a93da.tar.xz krb5-bb0718a30700e86dc2b69748b0af4521d59a93da.zip |
If no filespecs are provided, then return an empty profile
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11590 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/profile')
-rw-r--r-- | src/util/profile/prof_init.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/util/profile/prof_init.c b/src/util/profile/prof_init.c index 1f09f412ed..5668d98f3d 100644 --- a/src/util/profile/prof_init.c +++ b/src/util/profile/prof_init.c @@ -41,7 +41,9 @@ profile_init(files, ret_profile) memset(profile, 0, sizeof(struct _profile_t)); profile->magic = PROF_MAGIC_PROFILE; - for (fs = files; !PROFILE_LAST_FILESPEC(*fs); fs++) { + /* if the filenames list is not specified return an empty profile */ + if ( files ) { + for (fs = files; !PROFILE_LAST_FILESPEC(*fs); fs++) { retval = profile_open_file(*fs, &new_file); /* if this file is missing, skip to the next */ if (retval == ENOENT) { @@ -56,17 +58,19 @@ profile_init(files, ret_profile) else profile->first_file = new_file; last = new_file; - } - /* - * If last is still null after the loop, then all the files were - * missing, so return the appropriate error. - */ - if (!last) { + } + /* + * If last is still null after the loop, then all the files were + * missing, so return the appropriate error. + */ + if (!last) { profile_release(profile); return ENOENT; + } } - *ret_profile = profile; - return 0; + + *ret_profile = profile; + return 0; } #ifndef macintosh |