diff mbox

[ovs-dev,v2,2/3] windows: add includes to daemon-windows

Message ID 20170519202357.3772-2-aserdean@cloudbasesolutions.com
State Deferred
Headers show

Commit Message

Alin Serdean May 19, 2017, 8:25 p.m. UTC
Add fatal-signal.h include since it uses: fatal_signal_atexit_handler
and fatal_signal_add_hook

Use the defined getpid() function and also include <unistd.h> since
it is defined in include/windows/unistd.h .

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
---
v2: change fprintf %d to %ld (Ben Pfaff)
---
 lib/daemon-windows.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Ben Pfaff May 19, 2017, 11:04 p.m. UTC | #1
On Fri, May 19, 2017 at 08:25:11PM +0000, Alin Serdean wrote:
> Add fatal-signal.h include since it uses: fatal_signal_atexit_handler
> and fatal_signal_add_hook
> 
> Use the defined getpid() function and also include <unistd.h> since
> it is defined in include/windows/unistd.h .
> 
> Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
> ---
> v2: change fprintf %d to %ld (Ben Pfaff)

I agree that this should go in once patch 1 does.
diff mbox

Patch

diff --git a/lib/daemon-windows.c b/lib/daemon-windows.c
index 4fc97a8..55545f8 100644
--- a/lib/daemon-windows.c
+++ b/lib/daemon-windows.c
@@ -1,5 +1,5 @@ 
 /*
- * Copyright (c) 2014 Nicira, Inc.
+ * Copyright (c) 2014, 2017 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,7 +20,9 @@ 
 #include <stdio.h>
 #include <io.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include "dirs.h"
+#include "fatal-signal.h"
 #include "ovs-thread.h"
 #include "poll-loop.h"
 #include "openvswitch/vlog.h"
@@ -475,7 +477,7 @@  make_pidfile(void)
 
     fatal_signal_add_hook(unlink_pidfile, NULL, NULL, true);
 
-    fprintf(filep_pidfile, "%d\n", _getpid());
+    fprintf(filep_pidfile, "%ld\n", (long int) getpid());
     if (fflush(filep_pidfile) == EOF) {
         VLOG_FATAL("Failed to write into the pidfile %s", pidfile);
     }