Date: Fri, 26 Aug 2005 01:39:55 +0200
From: Harald Geyer <Harald.Geyer@gmx.at>
Message-ID: <E1E8RK7-0000TH-Dx@chello080108070152.13.11.univie.teleweb.at>
execlp (mhlproc, mhl, "-form", filter, "-noclear", NULL);
- fprintf (stderr, "unable to exec ");
- perror (mhlproc);
+ write(2, "unable to exec ", 15);
+ write(2, mhlproc, strlen(mhlproc));
+ write(2, strerror(errno), strlen(strerror(errno)));
The code you changed there is obviously broken (apart from using printf after
a vfork), but your replacement isn't a lot better - the "strerror(errno)"
calls (which you really should not do twice ... use a variable and save the
result!) the way you have it is getting the errno set from the write(2,
mhlproc, strlen(mhlproc)) sys call, where I suspect that you wanted the
errno from the execlp (which must have failed or the code wouldn't be being
executed).
write this as
char *errstr;
[...]
execlp(...);
errstr = strerror(errno);
write(2,....);
write(2,....);
/* maybe: write(2, ": ", 2); */
write(2, errstr, strlen(errstr));
write(2, "\n", 1);
kre
_______________________________________________
Nmh-workers mailing list
Nmh-workers@nongnu.org
http://lists.nongnu.org/mailman/listinfo/nmh-workers