lkml.org 
[lkml]   [2023]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [RFC v3 2/3] file: allow callers to free the old file descriptor after dup2
On Fri, Mar 24, 2023 at 05:15:25AM +0000, aloktiagi wrote:
> @@ -1119,8 +1119,12 @@ __releases(&files->file_lock)
> __clear_close_on_exec(fd, fdt);
> spin_unlock(&files->file_lock);
>
> - if (tofree)
> - filp_close(tofree, files);
> + if (fdfile) {
> + *fdfile = tofree;
> + } else {
> + if (tofree)
> + filp_close(tofree, files);
> + }

Why not:

if (fdfile)
*fdfile = tofree;
else if (tofree)
filp_close(tofree, files);

Shorter and makes the parallel structure more obvious.

\
 
 \ /
  Last update: 2023-03-27 01:16    [W:0.052 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site