Patchwork [06/10] vl: exit if we are not able to write into the pipe

login
register
mail settings
Submitter Juan Quintela
Date March 3, 2010, 12:06 p.m.
Message ID <df5d2141b01156f489600d559fa758c7e1ab1745.1267617582.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/46795/
State New
Headers show

Comments

Juan Quintela - March 3, 2010, 12:06 p.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 vl.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Kevin Wolf - March 3, 2010, 1:51 p.m.
Am 03.03.2010 13:06, schrieb Juan Quintela:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  vl.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/vl.c b/vl.c
> index db7a178..119c7e4 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -5745,6 +5745,7 @@ int main(int argc, char **argv, char **envp)
>              uint8_t status = 1;
>              if (write(fds[1], &status, 1) != 1) {
>                  perror("daemonize. Writing to pipe\n");
> +                exit(1);
>              }
>          } else
>  #endif

This is already the handling code for a fatal error, it's just trying to
tell the parent process that it went wrong. Completing the context:

            fprintf(stderr, "Could not acquire pid file: %s\n",
strerror(errno));
        exit(1);
    }

So there is already an exit(1), this patch doesn't change anything.

Kevin
Juan Quintela - March 3, 2010, 2 p.m.
Kevin Wolf <kwolf@redhat.com> wrote:
> Am 03.03.2010 13:06, schrieb Juan Quintela:
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  vl.c |    1 +
>>  1 files changed, 1 insertions(+), 0 deletions(-)
>> 
>> diff --git a/vl.c b/vl.c
>> index db7a178..119c7e4 100644
>> --- a/vl.c
>> +++ b/vl.c
>> @@ -5745,6 +5745,7 @@ int main(int argc, char **argv, char **envp)
>>              uint8_t status = 1;
>>              if (write(fds[1], &status, 1) != 1) {
>>                  perror("daemonize. Writing to pipe\n");
>> +                exit(1);
>>              }
>>          } else
>>  #endif
>
> This is already the handling code for a fatal error, it's just trying to
> tell the parent process that it went wrong. Completing the context:
>
>             fprintf(stderr, "Could not acquire pid file: %s\n",
> strerror(errno));
>         exit(1);
>     }
>
> So there is already an exit(1), this patch doesn't change anything.
>
> Kevin

Else without braces :(

You are right.  Would remove on respin.

Later, Juan.

Patch

diff --git a/vl.c b/vl.c
index db7a178..119c7e4 100644
--- a/vl.c
+++ b/vl.c
@@ -5745,6 +5745,7 @@  int main(int argc, char **argv, char **envp)
             uint8_t status = 1;
             if (write(fds[1], &status, 1) != 1) {
                 perror("daemonize. Writing to pipe\n");
+                exit(1);
             }
         } else
 #endif