> -----Original Message-----
> From: Vladimir Oltean <olte...@gmail.com>
> Sent: Monday, November 22, 2021 4:38 PM
> To: richardcoch...@gmail.com
> Cc: linuxptp-devel@lists.sourceforge.net
> Subject: [Linuxptp-devel] [PATCH 2/2] util: fix dangling file descriptors on 
> the
> error path of posix_clock_open
> 
> When we determine that the "device" argument represents a path to a char
> device, we call phc_open() and then we attempt to see, if the device
> real path starts with "/dev/ptp", what number comes afterwards. If that
> fails, we should close the char device we've just opened.
> 
> Fixes: 380d023abb1f ("posix_clock_open: derive PHC index from device name if
> possible")
> Signed-off-by: Vladimir Oltean <olte...@gmail.com>


Does this really need to be a separate commit? It seems like we could have 
squashed this into the same fix as the series.

Thanks,
Jake

> ---
>  util.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/util.c b/util.c
> index 686ed5e2f110..34b0bc8e109c 100644
> --- a/util.c
> +++ b/util.c
> @@ -226,7 +226,8 @@ clockid_t posix_clock_open(const char *device, int
> *phc_index)
>                               fprintf(stderr,
>                                       "failed to parse PHC index from %s\n",
>                                       phc_device_path);
> -                             return -1;
> +                             phc_close(clkid);
> +                             return CLOCK_INVALID;
>                       }
>               }
>               return clkid;
> --
> 2.25.1
> 
> 
> 
> _______________________________________________
> Linuxptp-devel mailing list
> Linuxptp-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to