diff options
author | shankar | 2010-03-05 03:25:36 +0000 |
---|---|---|
committer | shankar | 2010-03-05 03:25:36 +0000 |
commit | ba7084a17ecb13d8f70e80d6f0827afd7cbf5f4f (patch) | |
tree | db7036856e9cb3aedbcfba295731d864f400a7da /util | |
parent | 5a112e0865d76958138c86f8c51bf9eae00205ad (diff) | |
download | axis2c-ba7084a17ecb13d8f70e80d6f0827afd7cbf5f4f.tar.gz axis2c-ba7084a17ecb13d8f70e80d6f0827afd7cbf5f4f.tar.bz2 |
checking error status according to AXIS2C-1362
git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@919278 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'util')
-rw-r--r-- | util/src/dir_handler.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/util/src/dir_handler.c b/util/src/dir_handler.c index 4a5e51e..50d00b8 100644 --- a/util/src/dir_handler.c +++ b/util/src/dir_handler.c @@ -197,28 +197,52 @@ axutil_dir_handler_list_service_or_module_dirs( */ axis2_status_t status = AXIS2_FAILURE; - AXIS2_ENV_CHECK(env, NULL); - file_list = axutil_array_list_create(env, 0); + if(!AXIS2_GETCWD(cwd, 500)) + { + /* if we can't identify working directory, it will be a critical failure */ + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot identify working directory"); exit(1); + } /* pathname is path of services directory or modules directory. */ chdir_result = AXIS2_CHDIR(pathname); + if(chdir_result == -1) + { + /* we could not be able to find the path given. However, this will not be a problem + * because services and modules are optional. + */ + AXIS2_LOG_INFO(env->log, "Cannot find path %s.", pathname); + return NULL; + } #ifdef AXIS2_ARCHIVE_ENABLED axis2_archive_extract(); #endif count = AXIS2_SCANDIR(pathname, &files, dir_select, AXIS2_ALPHASORT); chdir_result = AXIS2_CHDIR(cwd); + if(chdir_result == -1) + { + /* we are changing back to working directory. If we can't change, this will be critical*/ + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot change directory to working directory"); + exit(1); + } /* If no files found, make a non-selectable menu item */ if(count <= 0) { - axutil_array_list_free(file_list, env); AXIS2_LOG_INFO(env->log, "No files in the path %s.", pathname); return NULL; } + file_list = axutil_array_list_create(env, 0); + if(!file_list) + { + AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Cannot create file list."); + AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE); + return NULL; + } + for(i = 1; i < (count + 1); ++i) { axis2_char_t *fname = NULL; |