Navigation Menu

Skip to content

Commit

Permalink
remove incorrect usage of vfork()
Browse files Browse the repository at this point in the history
From "man vfork(3)":

  The vfork() function shall be equivalent to fork(), except that the behavior
  is undefined if the process created by vfork() either modifies any data other
  than a variable of type pid_t used to store the return value from vfork(), or
  returns from the function in which vfork() was called, or calls any other
  function before successfully calling _exit() or one of the exec family of
  functions.

All of these instances do some filedescriptor modifications before calling
execve(). Since these were the only users of vfork() the tryvfork detection can
entirely go away.
  • Loading branch information
DerDakon authored and schmonz committed Aug 10, 2019
1 parent 75b8eb4 commit 0057e5f
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 24 deletions.
3 changes: 2 additions & 1 deletion CHANGES
@@ -1,4 +1,5 @@
20190805 version: notqmail 1.07.
201908xx version: notqmail 1.07.
20190819 remove incorrect usage of vfork()
20190710 code: add instchown to set ownership and mode on installed files.
20190709 code: add instpackage to install without root access.
20190714 code: removed idedit, install-big. var-qmail packages are no more.
Expand Down
7 changes: 0 additions & 7 deletions Makefile
Expand Up @@ -632,13 +632,6 @@ forgeries.0: \
forgeries.7
nroff -man forgeries.7 > forgeries.0

fork.h: \
compile load tryvfork.c fork.h1 fork.h2
( ( ./compile tryvfork.c && ./load tryvfork ) >/dev/null \
2>&1 \
&& cat fork.h2 || cat fork.h1 ) > fork.h
rm -f tryvfork.o tryvfork

forward: \
load forward.o qmail.o strerr.a alloc.a fd.a wait.a sig.a env.a \
substdio.a error.a str.a fs.a auto_qmail.o
Expand Down
1 change: 0 additions & 1 deletion TARGETS
Expand Up @@ -5,7 +5,6 @@ systype
load
make-compile
compile
fork.h
qmail-local.o
qmail.o
quote.o
Expand Down
1 change: 0 additions & 1 deletion fork.h1 → fork.h
Expand Up @@ -2,6 +2,5 @@
#define FORK_H

extern int fork();
#define vfork fork

#endif
7 changes: 0 additions & 7 deletions fork.h2

This file was deleted.

2 changes: 1 addition & 1 deletion qmail-lspawn.c
Expand Up @@ -156,7 +156,7 @@ char *local;
args[0] = "bin/qmail-getpw";
args[1] = local;
args[2] = 0;
switch(gpwpid = vfork())
switch(gpwpid = fork())
{
case -1:
_exit(QLX_SYS);
Expand Down
2 changes: 1 addition & 1 deletion qmail-rspawn.c
Expand Up @@ -96,7 +96,7 @@ char *s; char *r; int at;
args[3] = r;
args[4] = 0;

if (!(f = vfork()))
if (!(f = fork()))
{
if (fd_move(0,fdmess) == -1) _exit(111);
if (fd_move(1,fdout) == -1) _exit(111);
Expand Down
2 changes: 1 addition & 1 deletion qmail.c
Expand Up @@ -29,7 +29,7 @@ struct qmail *qq;
if (pipe(pim) == -1) return -1;
if (pipe(pie) == -1) { close(pim[0]); close(pim[1]); return -1; }

switch(qq->pid = vfork()) {
switch(qq->pid = fork()) {
case -1:
close(pim[0]); close(pim[1]);
close(pie[0]); close(pie[1]);
Expand Down
4 changes: 0 additions & 4 deletions tryvfork.c

This file was deleted.

0 comments on commit 0057e5f

Please sign in to comment.