Message ID | 20200409175725.20487-1-toertel@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | core: Fix CID 292129 save_stream() fd leak | expand |
On 09/04/20 19:57, Mark Jonas wrote: > 0 is a valid file descriptor. > > Signed-off-by: Mark Jonas <toertel@gmail.com> > --- > core/stream_interface.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/core/stream_interface.c b/core/stream_interface.c > index 163c253..0866ecd 100644 > --- a/core/stream_interface.c > +++ b/core/stream_interface.c > @@ -454,9 +454,9 @@ static int save_stream(int fdin, struct swupdate_cfg *software) > > no_copy_output: > free(buf); > - if (fdout > 0) > + if (fdout >= 0) > close(fdout); > - if (tmpfd > 0) { > + if (tmpfd >= 0) { > close(tmpfd); > unlink(tmpfilename); > } > @@ -597,4 +597,3 @@ int get_install_info(sourcetype *source, char *buf, size_t len) > > return len; > } > - > Acked-by: Stefano Babic <sbabic@denx.de> Best regards, Stefano Babic
diff --git a/core/stream_interface.c b/core/stream_interface.c index 163c253..0866ecd 100644 --- a/core/stream_interface.c +++ b/core/stream_interface.c @@ -454,9 +454,9 @@ static int save_stream(int fdin, struct swupdate_cfg *software) no_copy_output: free(buf); - if (fdout > 0) + if (fdout >= 0) close(fdout); - if (tmpfd > 0) { + if (tmpfd >= 0) { close(tmpfd); unlink(tmpfilename); } @@ -597,4 +597,3 @@ int get_install_info(sourcetype *source, char *buf, size_t len) return len; } -
0 is a valid file descriptor. Signed-off-by: Mark Jonas <toertel@gmail.com> --- core/stream_interface.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)