X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=python%2Fovs%2Fdaemon.py;h=0d119f202588abf290006f6dbb8aeea0606de28a;hb=47284b1fc6fe84a9b5b43b49bef868e4eb230cd1;hp=a919c53ecb4ab178f60e259086c827aa4b1af40b;hpb=723a8d23f5d9ba07d67bf4d312b00f001db5bdb4;p=openvswitch diff --git a/python/ovs/daemon.py b/python/ovs/daemon.py index a919c53e..0d119f20 100644 --- a/python/ovs/daemon.py +++ b/python/ovs/daemon.py @@ -141,7 +141,7 @@ def _make_pidfile(): # This is global to keep Python from garbage-collecting and # therefore closing our file after this function exits. That would # unlock the lock for us, and we don't want that. - global file + global file_handle file_handle = open(tmpfile, "w") except IOError, e: @@ -245,13 +245,19 @@ def _fork_and_wait_for_startup(): break if len(s) != 1: retval, status = _waitpid(pid, 0) - if (retval == pid and - os.WIFEXITED(status) and os.WEXITSTATUS(status)): - # Child exited with an error. Convey the same error to - # our parent process as a courtesy. - sys.exit(os.WEXITSTATUS(status)) + if retval == pid: + if os.WIFEXITED(status) and os.WEXITSTATUS(status): + # Child exited with an error. Convey the same error to + # our parent process as a courtesy. + sys.exit(os.WEXITSTATUS(status)) + else: + sys.stderr.write("fork child failed to signal " + "startup (%s)\n" + % ovs.process.status_msg(status)) else: - sys.stderr.write("fork child failed to signal startup\n") + assert retval < 0 + sys.stderr.write("waitpid failed (%s)\n" + % os.strerror(-retval)) sys.exit(1) os.close(rfd)