From bb0718a30700e86dc2b69748b0af4521d59a93da Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 23 Jul 1999 03:28:05 +0000 Subject: [PATCH] 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 --- src/util/profile/prof_init.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/util/profile/prof_init.c b/src/util/profile/prof_init.c index 1f09f412e..5668d98f3 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 -- 2.26.2