On Mon, Feb 06, 2017 at 04:41:40AM +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 <aserd...@cloudbasesolutions.com>
> ---
>  lib/daemon-windows.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/daemon-windows.c b/lib/daemon-windows.c
> index 7e2e9da..ccf4297 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"
> @@ -476,7 +478,7 @@ make_pidfile(void)
>  
>      fatal_signal_add_hook(unlink_pidfile, NULL, NULL, true);
>  
> -    fprintf(filep_pidfile, "%d\n", _getpid());
> +    fprintf(filep_pidfile, "%d\n", getpid());

This seems reasonable to me, except that usual practice would be more
like this:
    fprintf(filep_pidfile, "%ld\n", (long int) getpid());
because pid_t might be short or int or long.
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to