Mercurial > dropbear
changeset 667:fc7ae88e63b3
Rename HAVE_FORK to USE_VFORK
It makes it a bit more obvious why there's a test there since HAVE_FORK
is the normal case.
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 09 Apr 2012 20:35:13 +0800 |
parents | 0ad95abf8d3c |
children | 405418f7dc5e |
files | dbutil.c scp.c session.h svr-chansession.c svr-session.c sysoptions.h |
diffstat | 6 files changed, 23 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/dbutil.c Sun Apr 08 01:50:52 2012 -0400 +++ b/dbutil.c Mon Apr 09 20:35:13 2012 +0800 @@ -443,7 +443,7 @@ return DROPBEAR_FAILURE; } -#ifndef HAVE_FORK +#ifdef USE_VFORK pid = vfork(); #else pid = fork();
--- a/scp.c Sun Apr 08 01:50:52 2012 -0400 +++ b/scp.c Mon Apr 09 20:35:13 2012 +0800 @@ -130,7 +130,7 @@ fprintf(stderr, " %s", a->list[i]); fprintf(stderr, "\n"); } -#ifndef HAVE_FORK +#ifdef USE_VFORK pid = vfork(); #else pid = fork(); @@ -141,7 +141,7 @@ if (pid == 0) { execvp(a->list[0], a->list); perror(a->list[0]); -#ifndef HAVE_FORK +#ifdef USE_VFORK _exit(1); #else exit(1); @@ -210,12 +210,12 @@ /* uClinux needs to build the args here before vforking, otherwise we do it later on. */ -#ifndef HAVE_FORK +#ifdef USE_VFORK arg_setup(host, remuser, cmd); #endif /* Fork a child to execute the command on the remote host using ssh. */ -#ifndef HAVE_FORK +#ifdef USE_VFORK do_cmd_pid = vfork(); #else do_cmd_pid = fork(); @@ -230,13 +230,13 @@ close(pin[0]); close(pout[1]); -#ifndef HAVE_FORK +#ifdef USE_VFORK arg_setup(host, remuser, cmd); #endif execvp(ssh_program, args.list); perror(ssh_program); -#ifndef HAVE_FORK +#ifdef USE_VFORK _exit(1); #else exit(1); @@ -245,7 +245,7 @@ fatal("fork: %s", strerror(errno)); } -#ifndef HAVE_FORK +#ifdef USE_VFORK /* clean up command */ /* pop cmd */ xfree(args.list[args.num-1]);
--- a/session.h Sun Apr 08 01:50:52 2012 -0400 +++ b/session.h Mon Apr 09 20:35:13 2012 +0800 @@ -218,7 +218,7 @@ /* The resolved remote address, used for lastlog etc */ char *remotehost; -#ifndef HAVE_FORK +#ifdef USE_VFORK pid_t server_pid; #endif
--- a/svr-chansession.c Sun Apr 08 01:50:52 2012 -0400 +++ b/svr-chansession.c Mon Apr 09 20:35:13 2012 +0800 @@ -658,7 +658,7 @@ /* uClinux will vfork(), so there'll be a race as connection_string is freed below. */ -#ifdef HAVE_FORK +#ifndef USE_VFORK chansess->connection_string = make_connection_string(); #endif @@ -670,7 +670,7 @@ ret = ptycommand(channel, chansess); } -#ifdef HAVE_FORK +#ifndef USE_VFORK m_free(chansess->connection_string); #endif @@ -745,7 +745,7 @@ return DROPBEAR_FAILURE; } -#ifndef HAVE_FORK +#ifdef USE_VFORK pid = vfork(); #else pid = fork(); @@ -865,7 +865,7 @@ /* with uClinux we'll have vfork()ed, so don't want to overwrite the * hostkey. can't think of a workaround to clear it */ -#ifdef HAVE_FORK +#ifndef USE_VFORK /* wipe the hostkey */ sign_key_free(svr_opts.hostkey); svr_opts.hostkey = NULL;
--- a/svr-session.c Sun Apr 08 01:50:52 2012 -0400 +++ b/svr-session.c Mon Apr 09 20:35:13 2012 +0800 @@ -84,7 +84,7 @@ /* Initialise server specific parts of the session */ svr_ses.childpipe = childpipe; -#ifndef HAVE_FORK +#ifdef USE_VFORK svr_ses.server_pid = getpid(); #endif svr_authinitialise(); @@ -157,12 +157,10 @@ _dropbear_log(LOG_INFO, fmtbuf, param); -#ifndef HAVE_FORK - /* only the main server process should cleanup - we don't want +#ifdef USE_VFORK + /* For uclinux only the main server process should cleanup - we don't want * forked children doing that */ if (svr_ses.server_pid == getpid()) -#else - if (1) #endif { /* free potential public key options */
--- a/sysoptions.h Sun Apr 08 01:50:52 2012 -0400 +++ b/sysoptions.h Mon Apr 09 20:35:13 2012 +0800 @@ -216,4 +216,10 @@ #define IS_DROPBEAR_SERVER 0 #define IS_DROPBEAR_CLIENT 0 -#endif +#endif /* neither DROPBEAR_SERVER nor DROPBEAR_CLIENT */ + +#ifndef HAVE_FORK +#define USE_VFORK +#endif /* don't HAVE_FORK */ + +/* no include guard for this file */