]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
virsh: Remove bogus stat on log file
authorJiri Denemark <jdenemar@redhat.com>
Tue, 24 Jun 2014 08:50:10 +0000 (10:50 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 25 Jun 2014 22:43:38 +0000 (00:43 +0200)
Let's just open the file right away and deal with errors. Moreover,
there's no reason to forbid logging to, e.g., a pipe.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
tools/virsh.c

index 1bac84281ae4740c9d660bcc64e1c3a68149b9cf..3927120e15f35d9f8b1a9bc4bbf7890fbf70f5a7 100644 (file)
@@ -2794,29 +2794,9 @@ vshInit(vshControl *ctl)
 void
 vshOpenLogFile(vshControl *ctl)
 {
-    struct stat st;
-
     if (ctl->logfile == NULL)
         return;
 
-    /* check log file */
-    if (stat(ctl->logfile, &st) == -1) {
-        switch (errno) {
-            case ENOENT:
-                break;
-            default:
-                vshError(ctl, "%s",
-                         _("failed to get the log file information"));
-                exit(EXIT_FAILURE);
-        }
-    } else {
-        if (!S_ISREG(st.st_mode)) {
-            vshError(ctl, "%s", _("the log path is not a file"));
-            exit(EXIT_FAILURE);
-        }
-    }
-
-    /* log file open */
     if ((ctl->log_fd = open(ctl->logfile, LOGFILE_FLAGS, FILE_MODE)) < 0) {
         vshError(ctl, "%s",
                  _("failed to open the log file. check the log file path"));