Skip to content

Commit 60e199c

Browse files
committed
Revert "run-command: prettify -D_FORTIFY_SOURCE workaround"
This reverts commit ebec842, which somehow mistakenly thought that any non-zero return from write(2) is an error.
1 parent 4d8b32a commit 60e199c

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

run-command.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,26 +67,21 @@ static int child_notifier = -1;
6767

6868
static void notify_parent(void)
6969
{
70-
/*
71-
* execvp failed. If possible, we'd like to let start_command
72-
* know, so failures like ENOENT can be handled right away; but
73-
* otherwise, finish_command will still report the error.
74-
*/
75-
if (write(child_notifier, "", 1))
76-
; /* yes, dear gcc -D_FORTIFY_SOURCE, there was an error. */
70+
ssize_t unused;
71+
unused = write(child_notifier, "", 1);
7772
}
7873

7974
static NORETURN void die_child(const char *err, va_list params)
8075
{
8176
char msg[4096];
77+
ssize_t unused;
8278
int len = vsnprintf(msg, sizeof(msg), err, params);
8379
if (len > sizeof(msg))
8480
len = sizeof(msg);
8581

86-
if (write(child_err, "fatal: ", 7) ||
87-
write(child_err, msg, len) ||
88-
write(child_err, "\n", 1))
89-
; /* yes, gcc -D_FORTIFY_SOURCE, we know there was an error. */
82+
unused = write(child_err, "fatal: ", 7);
83+
unused = write(child_err, msg, len);
84+
unused = write(child_err, "\n", 1);
9085
exit(128);
9186
}
9287
#endif

0 commit comments

Comments
 (0)