From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: [PATCH] kvm tools: Setup bridged network by a script Date: Sat, 16 Apr 2011 11:55:43 +0200 Message-ID: <20110416095543.GA7305@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: KVM devel mailing list , Amos Kong To: Pekka Enberg Return-path: Received: from mx2.mail.elte.hu ([157.181.151.9]:36623 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758875Ab1DPJzw (ORCPT ); Sat, 16 Apr 2011 05:55:52 -0400 Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: Hi, i noticed this small detail: + if (strcmp(params->script, "none")) { + pid = fork(); + if (pid == 0) { + execl(params->script, params->script, net_device.tap_name, NULL); + _exit(1); + } else { + waitpid(pid, &status, 0); + if (WIFEXITED(status) && WEXITSTATUS(status) != 0) { + warning("Fail to setup tap by %s", params->script); + goto fail; + } + } this path does not seem to have robust error handling: both fork() and waitpid() can (and sometimes do) fail. If waitpid() fails then 'status' might be ununitialized as well, IIRC. Thanks, Ingo