From: Ben Pfaff Date: Tue, 4 Nov 2008 01:04:22 +0000 (-0800) Subject: Call VLOG_WARN before send_child_message(), to get correct errno value. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0202d2c76132d83ce39d10ef21260ca05ad6771c;p=openvswitch Call VLOG_WARN before send_child_message(), to get correct errno value. Otherwise we end up with nonsense like "failed to stat...: Success" in the log. --- diff --git a/secchan/executer.c b/secchan/executer.c index 7af1af3d..a430950e 100644 --- a/secchan/executer.c +++ b/secchan/executer.c @@ -205,24 +205,24 @@ executer_remote_packet_cb(struct relay *r, void *e_) /* Find the executable. */ exec_file = xasprintf("%s/%s", e->s->command_dir, argv[0]); if (stat(exec_file, &s)) { + VLOG_WARN("failed to stat \"%s\": %s", exec_file, strerror(errno)); send_child_message(r, request->header.xid, NXT_STATUS_ERROR, "command not allowed"); - VLOG_WARN("failed to stat \"%s\": %s", exec_file, strerror(errno)); goto done; } if (!S_ISREG(s.st_mode)) { + VLOG_WARN("\"%s\" is not a regular file", exec_file); send_child_message(r, request->header.xid, NXT_STATUS_ERROR, "command not allowed"); - VLOG_WARN("\"%s\" is not a regular file", exec_file); goto done; } argv[0] = exec_file; /* Arrange to capture output. */ if (pipe(output_fds)) { + VLOG_WARN("pipe failed: %s", strerror(errno)); send_child_message(r, request->header.xid, NXT_STATUS_ERROR, "internal error (pipe)"); - VLOG_WARN("pipe failed: %s", strerror(errno)); goto done; } @@ -252,8 +252,8 @@ executer_remote_packet_cb(struct relay *r, void *e_) /* Running in parent. */ struct child *child; - send_child_status(r, request->header.xid, NXT_STATUS_STARTED, NULL, 0); VLOG_WARN("started \"%s\" subprocess", argv[0]); + send_child_status(r, request->header.xid, NXT_STATUS_STARTED, NULL, 0); child = &e->children[e->n_children++]; child->name = xstrdup(argv[0]); child->pid = pid; @@ -265,9 +265,9 @@ executer_remote_packet_cb(struct relay *r, void *e_) set_nonblocking(output_fds[0]); close(output_fds[1]); } else { + VLOG_WARN("fork failed: %s", strerror(errno)); send_child_message(r, request->header.xid, NXT_STATUS_ERROR, "internal error (fork)"); - VLOG_WARN("fork failed: %s", strerror(errno)); close(output_fds[0]); close(output_fds[1]); }