mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
In piped_process, replace dprintf with more portable functions
dprint is missing on many non-glic platforms * libguile/posix.c (piped_process): replace dprintf with sprintf+write
This commit is contained in:
parent
9c86c5936e
commit
2e51d3fa26
1 changed files with 15 additions and 2 deletions
|
@ -1537,6 +1537,7 @@ piped_process (pid_t *pid, SCM prog, SCM args, SCM from, SCM to)
|
|||
int c2p[2] = {0, 0}; /* Child to parent. */
|
||||
int p2c[2] = {0, 0}; /* Parent to child. */
|
||||
int in = -1, out = -1, err = -1;
|
||||
char errbuf[200];
|
||||
char *exec_file;
|
||||
char **exec_argv;
|
||||
char **exec_env = environ;
|
||||
|
@ -1607,8 +1608,20 @@ piped_process (pid_t *pid, SCM prog, SCM args, SCM from, SCM to)
|
|||
default: /* ENOENT, etc. */
|
||||
/* Report the error on the console (before switching to
|
||||
'posix_spawn', the child process would do exactly that.) */
|
||||
dprintf (err, "In execvp of %s: %s\n", exec_file,
|
||||
strerror (errno_save));
|
||||
snprintf (errbuf, sizeof (errbuf), "In execvp of %s: %s\n", exec_file,
|
||||
strerror (errno_save));
|
||||
int n, i = 0;
|
||||
int len = strlen (errbuf);
|
||||
do
|
||||
{
|
||||
n = write (err, errbuf + i, len);
|
||||
if (n <= 0)
|
||||
break;
|
||||
len -= n;
|
||||
i += n;
|
||||
}
|
||||
while (len > 0);
|
||||
|
||||
}
|
||||
|
||||
free (exec_file);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue