git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make Perl strings translatable using perl-libintl.
[libguestfs.git]
/
daemon
/
guestfsd.c
diff --git
a/daemon/guestfsd.c
b/daemon/guestfsd.c
index
581c82e
..
87065b9
100644
(file)
--- a/
daemon/guestfsd.c
+++ b/
daemon/guestfsd.c
@@
-572,19
+572,23
@@
commandrv (char **stdoutput, char **stderror, char * const* const argv)
* trailing \n characters from the error buffer (not from stdout).
*/
if (stdoutput) {
* trailing \n characters from the error buffer (not from stdout).
*/
if (stdoutput) {
-
*stdoutput
= realloc (*stdoutput, so_size+1);
- if (
*stdoutput
== NULL) {
+
void *q
= realloc (*stdoutput, so_size+1);
+ if (
q
== NULL) {
perror ("realloc");
perror ("realloc");
- *stdoutput = NULL;
- } else
+ free (*stdoutput);
+ }
+ *stdoutput = q;
+ if (*stdoutput)
(*stdoutput)[so_size] = '\0';
}
if (stderror) {
(*stdoutput)[so_size] = '\0';
}
if (stderror) {
-
*stderror
= realloc (*stderror, se_size+1);
- if (
*stderror
== NULL) {
+
void *q
= realloc (*stderror, se_size+1);
+ if (
q
== NULL) {
perror ("realloc");
perror ("realloc");
- *stderror = NULL;
- } else {
+ free (*stderror);
+ }
+ *stderror = q;
+ if (*stderror) {
(*stderror)[se_size] = '\0';
se_size--;
while (se_size >= 0 && (*stderror)[se_size] == '\n')
(*stderror)[se_size] = '\0';
se_size--;
while (se_size >= 0 && (*stderror)[se_size] == '\n')