mirror of
https://github.com/clearml/dropbear
synced 2025-01-31 10:57:01 +00:00
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.
This commit is contained in:
parent
c957edbe75
commit
49b79fa02d
2
dbutil.c
2
dbutil.c
@ -443,7 +443,7 @@ int spawn_command(void(*exec_fn)(void *user_data), void *exec_data,
|
|||||||
return DROPBEAR_FAILURE;
|
return DROPBEAR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_FORK
|
#ifdef USE_VFORK
|
||||||
pid = vfork();
|
pid = vfork();
|
||||||
#else
|
#else
|
||||||
pid = fork();
|
pid = fork();
|
||||||
|
14
scp.c
14
scp.c
@ -130,7 +130,7 @@ do_local_cmd(arglist *a)
|
|||||||
fprintf(stderr, " %s", a->list[i]);
|
fprintf(stderr, " %s", a->list[i]);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
#ifndef HAVE_FORK
|
#ifdef USE_VFORK
|
||||||
pid = vfork();
|
pid = vfork();
|
||||||
#else
|
#else
|
||||||
pid = fork();
|
pid = fork();
|
||||||
@ -141,7 +141,7 @@ do_local_cmd(arglist *a)
|
|||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
execvp(a->list[0], a->list);
|
execvp(a->list[0], a->list);
|
||||||
perror(a->list[0]);
|
perror(a->list[0]);
|
||||||
#ifndef HAVE_FORK
|
#ifdef USE_VFORK
|
||||||
_exit(1);
|
_exit(1);
|
||||||
#else
|
#else
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -210,12 +210,12 @@ do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout, int argc)
|
|||||||
|
|
||||||
/* uClinux needs to build the args here before vforking,
|
/* uClinux needs to build the args here before vforking,
|
||||||
otherwise we do it later on. */
|
otherwise we do it later on. */
|
||||||
#ifndef HAVE_FORK
|
#ifdef USE_VFORK
|
||||||
arg_setup(host, remuser, cmd);
|
arg_setup(host, remuser, cmd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Fork a child to execute the command on the remote host using ssh. */
|
/* Fork a child to execute the command on the remote host using ssh. */
|
||||||
#ifndef HAVE_FORK
|
#ifdef USE_VFORK
|
||||||
do_cmd_pid = vfork();
|
do_cmd_pid = vfork();
|
||||||
#else
|
#else
|
||||||
do_cmd_pid = fork();
|
do_cmd_pid = fork();
|
||||||
@ -230,13 +230,13 @@ do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout, int argc)
|
|||||||
close(pin[0]);
|
close(pin[0]);
|
||||||
close(pout[1]);
|
close(pout[1]);
|
||||||
|
|
||||||
#ifndef HAVE_FORK
|
#ifdef USE_VFORK
|
||||||
arg_setup(host, remuser, cmd);
|
arg_setup(host, remuser, cmd);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
execvp(ssh_program, args.list);
|
execvp(ssh_program, args.list);
|
||||||
perror(ssh_program);
|
perror(ssh_program);
|
||||||
#ifndef HAVE_FORK
|
#ifdef USE_VFORK
|
||||||
_exit(1);
|
_exit(1);
|
||||||
#else
|
#else
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -245,7 +245,7 @@ do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout, int argc)
|
|||||||
fatal("fork: %s", strerror(errno));
|
fatal("fork: %s", strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_FORK
|
#ifdef USE_VFORK
|
||||||
/* clean up command */
|
/* clean up command */
|
||||||
/* pop cmd */
|
/* pop cmd */
|
||||||
xfree(args.list[args.num-1]);
|
xfree(args.list[args.num-1]);
|
||||||
|
@ -218,7 +218,7 @@ struct serversession {
|
|||||||
/* The resolved remote address, used for lastlog etc */
|
/* The resolved remote address, used for lastlog etc */
|
||||||
char *remotehost;
|
char *remotehost;
|
||||||
|
|
||||||
#ifndef HAVE_FORK
|
#ifdef USE_VFORK
|
||||||
pid_t server_pid;
|
pid_t server_pid;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -658,7 +658,7 @@ static int sessioncommand(struct Channel *channel, struct ChanSess *chansess,
|
|||||||
|
|
||||||
/* uClinux will vfork(), so there'll be a race as
|
/* uClinux will vfork(), so there'll be a race as
|
||||||
connection_string is freed below. */
|
connection_string is freed below. */
|
||||||
#ifdef HAVE_FORK
|
#ifndef USE_VFORK
|
||||||
chansess->connection_string = make_connection_string();
|
chansess->connection_string = make_connection_string();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -670,7 +670,7 @@ static int sessioncommand(struct Channel *channel, struct ChanSess *chansess,
|
|||||||
ret = ptycommand(channel, chansess);
|
ret = ptycommand(channel, chansess);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_FORK
|
#ifndef USE_VFORK
|
||||||
m_free(chansess->connection_string);
|
m_free(chansess->connection_string);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -745,7 +745,7 @@ static int ptycommand(struct Channel *channel, struct ChanSess *chansess) {
|
|||||||
return DROPBEAR_FAILURE;
|
return DROPBEAR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_FORK
|
#ifdef USE_VFORK
|
||||||
pid = vfork();
|
pid = vfork();
|
||||||
#else
|
#else
|
||||||
pid = fork();
|
pid = fork();
|
||||||
@ -865,7 +865,7 @@ static void execchild(void *user_data) {
|
|||||||
|
|
||||||
/* with uClinux we'll have vfork()ed, so don't want to overwrite the
|
/* with uClinux we'll have vfork()ed, so don't want to overwrite the
|
||||||
* hostkey. can't think of a workaround to clear it */
|
* hostkey. can't think of a workaround to clear it */
|
||||||
#ifdef HAVE_FORK
|
#ifndef USE_VFORK
|
||||||
/* wipe the hostkey */
|
/* wipe the hostkey */
|
||||||
sign_key_free(svr_opts.hostkey);
|
sign_key_free(svr_opts.hostkey);
|
||||||
svr_opts.hostkey = NULL;
|
svr_opts.hostkey = NULL;
|
||||||
|
@ -84,7 +84,7 @@ void svr_session(int sock, int childpipe) {
|
|||||||
|
|
||||||
/* Initialise server specific parts of the session */
|
/* Initialise server specific parts of the session */
|
||||||
svr_ses.childpipe = childpipe;
|
svr_ses.childpipe = childpipe;
|
||||||
#ifndef HAVE_FORK
|
#ifdef USE_VFORK
|
||||||
svr_ses.server_pid = getpid();
|
svr_ses.server_pid = getpid();
|
||||||
#endif
|
#endif
|
||||||
svr_authinitialise();
|
svr_authinitialise();
|
||||||
@ -157,12 +157,10 @@ void svr_dropbear_exit(int exitcode, const char* format, va_list param) {
|
|||||||
|
|
||||||
_dropbear_log(LOG_INFO, fmtbuf, param);
|
_dropbear_log(LOG_INFO, fmtbuf, param);
|
||||||
|
|
||||||
#ifndef HAVE_FORK
|
#ifdef USE_VFORK
|
||||||
/* only the main server process should cleanup - we don't want
|
/* For uclinux only the main server process should cleanup - we don't want
|
||||||
* forked children doing that */
|
* forked children doing that */
|
||||||
if (svr_ses.server_pid == getpid())
|
if (svr_ses.server_pid == getpid())
|
||||||
#else
|
|
||||||
if (1)
|
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
/* free potential public key options */
|
/* free potential public key options */
|
||||||
|
@ -216,4 +216,10 @@
|
|||||||
#define IS_DROPBEAR_SERVER 0
|
#define IS_DROPBEAR_SERVER 0
|
||||||
#define IS_DROPBEAR_CLIENT 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 */
|
||||||
|
Loading…
Reference in New Issue
Block a user