diff options
-rw-r--r-- | build/aplibtool.c | 5 | ||||
-rw-r--r-- | build/jlibtool.c | 4 | ||||
-rw-r--r-- | dbd/apr_dbd_oracle.c | 2 | ||||
-rw-r--r-- | dbm/apr_dbm_sdbm.c | 2 | ||||
-rw-r--r-- | file_io/netware/pipe.c | 3 | ||||
-rw-r--r-- | file_io/os2/open.c | 2 | ||||
-rw-r--r-- | file_io/unix/open.c | 8 | ||||
-rw-r--r-- | file_io/win32/open.c | 4 | ||||
-rw-r--r-- | memory/unix/apr_pools.c | 1 | ||||
-rw-r--r-- | threadproc/beos/proc.c | 7 | ||||
-rw-r--r-- | threadproc/unix/proc.c | 7 | ||||
-rw-r--r-- | threadproc/unix/procsup.c | 4 |
12 files changed, 22 insertions, 27 deletions
diff --git a/build/aplibtool.c b/build/aplibtool.c index 357dbb993..602f045fe 100644 --- a/build/aplibtool.c +++ b/build/aplibtool.c @@ -300,7 +300,6 @@ bool parse_input_file_name(char *arg, cmd_data_t *cmd_data) { char *ext = strrchr(arg, '.'); char *name = strrchr(arg, '/'); - int pathlen; char *newarg; if (!ext) { @@ -321,8 +320,6 @@ bool parse_input_file_name(char *arg, cmd_data_t *cmd_data) name++; } - pathlen = name - arg; - if (strcmp(ext, "lo") == 0) { newarg = (char *)malloc(strlen(arg) + 10); strcpy(newarg, arg); @@ -362,7 +359,6 @@ bool parse_output_file_name(char *arg, cmd_data_t *cmd_data) char *name = strrchr(arg, '/'); char *ext = strrchr(arg, '.'); char *newarg = NULL, *newext; - int pathlen; if (name == NULL) { name = strrchr(arg, '\\'); @@ -392,7 +388,6 @@ bool parse_output_file_name(char *arg, cmd_data_t *cmd_data) } ext++; - pathlen = name - arg; if (strcmp(ext, "exe") == 0) { cmd_data->output_type = otProgram; diff --git a/build/jlibtool.c b/build/jlibtool.c index 1ad5a1b27..892e26d56 100644 --- a/build/jlibtool.c +++ b/build/jlibtool.c @@ -1650,7 +1650,7 @@ const char* expand_path(const char *relpath) getcwd(foo, PATH_MAX-1); newpath = (char*)malloc(strlen(foo)+strlen(relpath)+2); - strcat(newpath, foo); + strcpy(newpath, foo); strcat(newpath, "/"); strcat(newpath, relpath); return newpath; @@ -1682,7 +1682,7 @@ void link_fixup(command_t *c) push_count_chars(c->shared_opts.normal, DYNAMIC_INSTALL_NAME); tmp = (char*)malloc(PATH_MAX); - strcat(tmp, c->install_path); + strcpy(tmp, c->install_path); strcat(tmp, strrchr(c->shared_name.normal, '/')); push_count_chars(c->shared_opts.normal, tmp); #endif diff --git a/dbd/apr_dbd_oracle.c b/dbd/apr_dbd_oracle.c index 1de349018..df3ebcc67 100644 --- a/dbd/apr_dbd_oracle.c +++ b/dbd/apr_dbd_oracle.c @@ -1758,8 +1758,8 @@ static int dbd_oracle_end_transaction(apr_dbd_transaction_t *trans) { int ret = 1; /* no transaction is an error cond */ sword status; - apr_dbd_t *handle = trans->handle; if (trans) { + apr_dbd_t *handle = trans->handle; switch (trans->status) { case TRANS_NONE: /* No trans is an error here */ status = OCI_ERROR; diff --git a/dbm/apr_dbm_sdbm.c b/dbm/apr_dbm_sdbm.c index 7a246dd4f..7c105d2eb 100644 --- a/dbm/apr_dbm_sdbm.c +++ b/dbm/apr_dbm_sdbm.c @@ -193,7 +193,7 @@ static apr_status_t vt_sdbm_nextkey(apr_dbm_t *dbm, apr_datum_t *pkey) pkey->dsize = rd.dsize; /* store any error info into DBM, and return a status code. */ - return set_error(dbm, APR_SUCCESS); + return set_error(dbm, rv); } static void vt_sdbm_freedatum(apr_dbm_t *dbm, apr_datum_t data) diff --git a/file_io/netware/pipe.c b/file_io/netware/pipe.c index 3e8f55935..f88f1e625 100644 --- a/file_io/netware/pipe.c +++ b/file_io/netware/pipe.c @@ -26,7 +26,6 @@ static apr_status_t pipeblock(apr_file_t *thepipe) { #ifdef USE_FLAGS - int err; unsigned long flags; if (fcntl(thepipe->filedes, F_GETFL, &flags) != -1) @@ -49,7 +48,6 @@ static apr_status_t pipeblock(apr_file_t *thepipe) static apr_status_t pipenonblock(apr_file_t *thepipe) { #ifdef USE_FLAGS - int err; unsigned long flags; errno = 0; @@ -138,7 +136,6 @@ APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file, APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t *pool) { int filedes[2]; - int err; if (pipe(filedes) == -1) { return errno; diff --git a/file_io/os2/open.c b/file_io/os2/open.c index c9d32deb9..cd629dc8e 100644 --- a/file_io/os2/open.c +++ b/file_io/os2/open.c @@ -148,7 +148,7 @@ APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file) file->mutex = NULL; } - return APR_SUCCESS; + return status; } diff --git a/file_io/unix/open.c b/file_io/unix/open.c index ce4378577..ba271cb05 100644 --- a/file_io/unix/open.c +++ b/file_io/unix/open.c @@ -180,13 +180,17 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, if (!(flag & APR_FOPEN_NOCLEANUP)) { int flags; - if ((flags = fcntl(fd, F_GETFD)) == -1) + if ((flags = fcntl(fd, F_GETFD)) == -1) { + close(fd); return errno; + } if ((flags & FD_CLOEXEC) == 0) { flags |= FD_CLOEXEC; - if (fcntl(fd, F_SETFD, flags) == -1) + if (fcntl(fd, F_SETFD, flags) == -1) { + close(fd); return errno; + } } } diff --git a/file_io/win32/open.c b/file_io/win32/open.c index a4e6f2692..c6afa5fe8 100644 --- a/file_io/win32/open.c +++ b/file_io/win32/open.c @@ -145,7 +145,6 @@ void *res_name_from_filename(const char *file, int global, apr_pool_t *pool) apr_wchar_t *wpre, *wfile, *ch; apr_size_t n = strlen(file) + 1; apr_size_t r, d; - apr_status_t rv; if (apr_os_level >= APR_WIN_2000) { if (global) @@ -169,7 +168,7 @@ void *res_name_from_filename(const char *file, int global, apr_pool_t *pool) wfile = apr_palloc(pool, (r + n) * sizeof(apr_wchar_t)); wcscpy(wfile, wpre); d = n; - if ((rv = apr_conv_utf8_to_ucs2(file, &n, wfile + r, &d))) { + if (apr_conv_utf8_to_ucs2(file, &n, wfile + r, &d)) { return NULL; } for (ch = wfile + r; *ch; ++ch) { @@ -186,7 +185,6 @@ void *res_name_from_filename(const char *file, int global, apr_pool_t *pool) apr_size_t n = strlen(file) + 1; #if !APR_HAS_UNICODE_FS - apr_status_t rv; apr_size_t r, d; char *pre; diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c index d3c81fc34..08b43fba0 100644 --- a/memory/unix/apr_pools.c +++ b/memory/unix/apr_pools.c @@ -1427,6 +1427,7 @@ static void *pool_alloc(apr_pool_t *pool, apr_size_t size) node = pool->nodes; if (node == NULL || node->index == 64) { if ((node = malloc(SIZEOF_DEBUG_NODE_T)) == NULL) { + free(mem); if (pool->abort_fn) pool->abort_fn(APR_ENOMEM); diff --git a/threadproc/beos/proc.c b/threadproc/beos/proc.c index 3092f4502..e3698082f 100644 --- a/threadproc/beos/proc.c +++ b/threadproc/beos/proc.c @@ -362,8 +362,9 @@ APR_DECLARE(apr_status_t) apr_procattr_child_in_set(apr_procattr_t *attr, apr_fi == APR_SUCCESS) rv = apr_file_inherit_set(attr->child_in); } + } - if (parent_in != NULL && rv == APR_SUCCESS) { + if (parent_in != NULL && rv == APR_SUCCESS) rv = apr_file_dup(&attr->parent_in, parent_in, attr->pool); return rv; @@ -391,7 +392,7 @@ APR_DECLARE(apr_status_t) apr_procattr_child_out_set(apr_procattr_t *attr, apr_f } } - if (parent_out != NULL && rv == APR_SUCCESS) { + if (parent_out != NULL && rv == APR_SUCCESS) rv = apr_file_dup(&attr->parent_out, parent_out, attr->pool); return rv; @@ -419,7 +420,7 @@ APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr, apr_f } } - if (parent_err != NULL && rv == APR_SUCCESS) { + if (parent_err != NULL && rv == APR_SUCCESS) rv = apr_file_dup(&attr->parent_err, parent_err, attr->pool); return rv; diff --git a/threadproc/unix/proc.c b/threadproc/unix/proc.c index b9a674b7f..8deb6de2f 100644 --- a/threadproc/unix/proc.c +++ b/threadproc/unix/proc.c @@ -396,7 +396,6 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, return errno; } else if (new->pid == 0) { - int status; /* child process */ /* @@ -478,7 +477,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, } /* Only try to switch if we are running as root */ if (attr->gid != -1 && !geteuid()) { - if ((status = setgid(attr->gid))) { + if (setgid(attr->gid)) { if (attr->errfn) { attr->errfn(pool, errno, "setting of group failed"); } @@ -487,7 +486,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, } if (attr->uid != -1 && !geteuid()) { - if ((status = setuid(attr->uid))) { + if (setuid(attr->uid)) { if (attr->errfn) { attr->errfn(pool, errno, "setting of user failed"); } @@ -495,7 +494,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, } } - if ((status = limit_proc(attr)) != APR_SUCCESS) { + if (limit_proc(attr) != APR_SUCCESS) { if (attr->errfn) { attr->errfn(pool, errno, "setting of resource limits failed"); } diff --git a/threadproc/unix/procsup.c b/threadproc/unix/procsup.c index 376baf21f..94177f92a 100644 --- a/threadproc/unix/procsup.c +++ b/threadproc/unix/procsup.c @@ -18,8 +18,6 @@ APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize) { - int x; - if (chdir("/") == -1) { return errno; } @@ -28,6 +26,8 @@ APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize) /* Don't detach for MPE because child processes can't survive the death of * the parent. */ if (daemonize) { + int x; + if ((x = fork()) > 0) { exit(0); } |