vlog: Only compile vlog_change_owner on Unix platform
authorAndy Zhou <azhou@nicira.com>
Thu, 12 Nov 2015 02:49:04 +0000 (18:49 -0800)
committerAndy Zhou <azhou@nicira.com>
Thu, 12 Nov 2015 02:54:10 +0000 (18:54 -0800)
uid_t and gid_t are not defined for Windows platform.

Signed-off-by: Andy Zhou <azhou@nicira.com>
include/openvswitch/vlog.h
lib/daemon-unix.c
lib/vlog.c

index bc16590..5309602 100644 (file)
@@ -143,7 +143,9 @@ void vlog_set_verbosity(const char *arg);
 void vlog_set_pattern(enum vlog_destination, const char *pattern);
 int vlog_set_log_file(const char *file_name);
 int vlog_reopen_log_file(void);
-void vlog_change_owner(uid_t, gid_t);
+#ifndef _WIN32
+void vlog_change_owner_unix(uid_t, gid_t);
+#endif
 
 /* Configure method how vlog should send messages to syslog server. */
 void vlog_set_syslog_method(const char *method);
index e69517a..a471b59 100644 (file)
@@ -849,7 +849,7 @@ daemon_become_new_user__(bool access_datapath)
 {
     /* If vlog file has been created, change its owner to the non-root user
      * as specifed by the --user option.  */
-    vlog_change_owner(uid, gid);
+    vlog_change_owner_unix(uid, gid);
 
     if (LINUX) {
         if (LIBCAPNG) {
index 841c7a4..18d0e33 100644 (file)
@@ -430,12 +430,13 @@ vlog_reopen_log_file(void)
     }
 }
 
+#ifndef _WIN32
 /* In case a log file exists, change its owner to new 'user' and 'group'.
  *
  * This is useful for handling cases where the --log-file option is
  * specified ahead of the --user option.  */
 void
-vlog_change_owner(uid_t user, gid_t group)
+vlog_change_owner_unix(uid_t user, gid_t group)
 {
     if (!log_file_name) {
         return;
@@ -450,6 +451,7 @@ vlog_change_owner(uid_t user, gid_t group)
                    log_file_name, ovs_strerror(errno));
     }
 }
+#endif
 
 /* Set debugging levels.  Returns null if successful, otherwise an error
  * message that the caller must free(). */