Fix mysterious sendmail coredump on systems where malloc.conf pointed to

a string containign 'J'.

o Properly terminate argv list with a NULL entry.
o Use warn() to report the exec failure because free could change errno and
  err would report the wrong reason.
o Don't terminate string to err with ':' since this results in two colons.
This commit is contained in:
Warner Losh 2000-01-10 01:25:53 +00:00
parent cf60e8e4bf
commit 59536d2892
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=55698

View File

@ -78,7 +78,7 @@ addarg(al, arg, copy)
}
if (copy) {
if ((al->argv[al->argc++] = strdup(arg)) == NULL)
err(1, "mailwrapper:");
err(1, "mailwrapper");
} else
al->argv[al->argc++] = (char *)arg;
}
@ -152,10 +152,12 @@ main(argc, argv, envp)
(void)fclose(config);
al.argv[al.argc] = NULL;
execve(to, al.argv, envp);
warn("mailwrapper: execing %s", to);
freearg(&al, 0);
free(line);
err(1, "mailwrapper: execing %s", to);
exit(1);
/*NOTREACHED*/
parse_error:
freearg(&al, 0);