slirp: check system() success

we shouldn't call W*() macros until we check that fork worked.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Juan Quintela 2010-03-04 10:00:31 +01:00 committed by Anthony Liguori
parent 48b66db9ea
commit 24ac07dec7

View file

@ -472,7 +472,7 @@ static void slirp_smb_cleanup(SlirpState *s)
if (s->smb_dir[0] != '\0') { if (s->smb_dir[0] != '\0') {
snprintf(cmd, sizeof(cmd), "rm -rf %s", s->smb_dir); snprintf(cmd, sizeof(cmd), "rm -rf %s", s->smb_dir);
ret = system(cmd); ret = system(cmd);
if (!WIFEXITED(ret)) { if (ret == -1 || !WIFEXITED(ret)) {
qemu_error("'%s' failed.\n", cmd); qemu_error("'%s' failed.\n", cmd);
} else if (WEXITSTATUS(ret)) { } else if (WEXITSTATUS(ret)) {
qemu_error("'%s' failed. Error code: %d\n", qemu_error("'%s' failed. Error code: %d\n",