| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: common.c,v 1.5 2016/11/27 11:46:45 joerg Exp $ */ | | 1 | /* $NetBSD: common.c,v 1.6 2016/12/09 22:25:28 joerg Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2009 Joerg Sonnenberger <joerg@NetBSD.org>. | | 4 | * Copyright (c) 2009 Joerg Sonnenberger <joerg@NetBSD.org>. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * | | 10 | * |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in | | 14 | * notice, this list of conditions and the following disclaimer in |
| @@ -304,26 +304,29 @@ worklog_cmd(FILE *worklog, const char *p | | | @@ -304,26 +304,29 @@ worklog_cmd(FILE *worklog, const char *p |
304 | buf = xmalloc(buflen); | | 304 | buf = xmalloc(buflen); |
305 | shquote(arg->val, buf, buflen); | | 305 | shquote(arg->val, buf, buflen); |
306 | } | | 306 | } |
307 | fputc(' ', worklog); | | 307 | fputc(' ', worklog); |
308 | fputs(buf, worklog); | | 308 | fputs(buf, worklog); |
309 | } | | 309 | } |
310 | | | 310 | |
311 | fputc('\n', worklog); | | 311 | fputc('\n', worklog); |
312 | | | 312 | |
313 | if (buf) | | 313 | if (buf) |
314 | free(buf); | | 314 | free(buf); |
315 | } | | 315 | } |
316 | | | 316 | |
| | | 317 | #if __GNUC__ + 0 >= 3 |
| | | 318 | __attribute__((__noreturn__)) |
| | | 319 | #endif |
317 | static void | | 320 | static void |
318 | command_child_exec(char **argv) | | 321 | command_child_exec(char **argv) |
319 | { | | 322 | { |
320 | static const char failed_exec_msg[] = "exec failed\n"; | | 323 | static const char failed_exec_msg[] = "exec failed\n"; |
321 | int status; | | 324 | int status; |
322 | | | 325 | |
323 | execvp(exec_name, argv); | | 326 | execvp(exec_name, argv); |
324 | status = write(STDERR_FILENO, failed_exec_msg, | | 327 | status = write(STDERR_FILENO, failed_exec_msg, |
325 | sizeof(failed_exec_msg) - 1); | | 328 | sizeof(failed_exec_msg) - 1); |
326 | _exit(255 | status); | | 329 | _exit(255 | status); |
327 | } | | 330 | } |
328 | | | 331 | |
329 | int | | 332 | int |