mirror of
https://github.com/python/cpython.git
synced 2025-10-18 12:48:57 +00:00
Avoid the compiler warning about the unused return value.
This commit is contained in:
parent
f49d152ab2
commit
12fdca59bb
1 changed files with 9 additions and 6 deletions
|
@ -51,7 +51,7 @@ static void child_exec(char *const exec_array[],
|
||||||
PyObject *preexec_fn,
|
PyObject *preexec_fn,
|
||||||
PyObject *preexec_fn_args_tuple)
|
PyObject *preexec_fn_args_tuple)
|
||||||
{
|
{
|
||||||
int i, saved_errno, fd_num;
|
int i, saved_errno, fd_num, unused;
|
||||||
PyObject *result;
|
PyObject *result;
|
||||||
const char* err_msg = "";
|
const char* err_msg = "";
|
||||||
/* Buffer large enough to hold a hex integer. We can't malloc. */
|
/* Buffer large enough to hold a hex integer. We can't malloc. */
|
||||||
|
@ -189,22 +189,25 @@ static void child_exec(char *const exec_array[],
|
||||||
error:
|
error:
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
/* Report the posix error to our parent process. */
|
/* Report the posix error to our parent process. */
|
||||||
|
/* We ignore all write() return values as the total size of our writes is
|
||||||
|
* less than PIPEBUF and we cannot do anything about an error anyways. */
|
||||||
if (saved_errno) {
|
if (saved_errno) {
|
||||||
char *cur;
|
char *cur;
|
||||||
write(errpipe_write, "OSError:", 8);
|
unused = write(errpipe_write, "OSError:", 8);
|
||||||
cur = hex_errno + sizeof(hex_errno);
|
cur = hex_errno + sizeof(hex_errno);
|
||||||
while (saved_errno != 0 && cur > hex_errno) {
|
while (saved_errno != 0 && cur > hex_errno) {
|
||||||
*--cur = "0123456789ABCDEF"[saved_errno % 16];
|
*--cur = "0123456789ABCDEF"[saved_errno % 16];
|
||||||
saved_errno /= 16;
|
saved_errno /= 16;
|
||||||
}
|
}
|
||||||
write(errpipe_write, cur, hex_errno + sizeof(hex_errno) - cur);
|
unused = write(errpipe_write, cur, hex_errno + sizeof(hex_errno) - cur);
|
||||||
write(errpipe_write, ":", 1);
|
unused = write(errpipe_write, ":", 1);
|
||||||
/* We can't call strerror(saved_errno). It is not async signal safe.
|
/* We can't call strerror(saved_errno). It is not async signal safe.
|
||||||
* The parent process will look the error message up. */
|
* The parent process will look the error message up. */
|
||||||
} else {
|
} else {
|
||||||
write(errpipe_write, "RuntimeError:0:", 15);
|
unused = write(errpipe_write, "RuntimeError:0:", 15);
|
||||||
write(errpipe_write, err_msg, strlen(err_msg));
|
unused = write(errpipe_write, err_msg, strlen(err_msg));
|
||||||
}
|
}
|
||||||
|
if (unused) return; /* silly? yes! avoids gcc compiler warning. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue