[Tarantool-patches] [PATCH 04/13] popen: add logging of fds closed in a child

Alexander Turenko alexander.turenko at tarantool.org
Fri Apr 10 15:19:38 MSK 2020


On Fri, Apr 10, 2020 at 10:46:42AM +0300, Cyrill Gorcunov wrote:
> On Fri, Apr 10, 2020 at 05:50:42AM +0300, Alexander Turenko wrote:
> > It is useful for debugging popen behaviour around file descriptors.
> > 
> > Part of #4031
> Acked-by: Cyrill Gorcunov <gorcunov at gmail.com>
> 
> > ---
> >  src/lib/core/popen.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c
> > index 3fcbc325a..9d4e6ef3a 100644
> > --- a/src/lib/core/popen.c
> > +++ b/src/lib/core/popen.c
> > @@ -579,6 +579,8 @@ close_inherited_fds(int *skip_fds, size_t nr_skip_fds)
> >  		if (fd_no == -1)
> >  			continue;
> >  
> > +		say_debug("popen: close inherited fd [%s:%d]", stdX_str(fd_no),
> > +			  fd_no);
> 
> Can we please shift args a bit, like
> 
> 		say_debug("popen: close inherited fd [%s:%d]",
> 			  stdX_str(fd_no), fd_no);

My approach is to keep lines within 80 symbols, but don't break lines
prematurely.

I asked Cyrill what is the general approach he use, because I don't want
change code back and forth due to different styles within one file.

The answer is that one dangling word looks ugly. It is not strict
criteria, however I will try to follow it (at least when editing
Cyrill's code).

Changed:

diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c
index 9d4e6ef3a..e5e7e5cfc 100644
--- a/src/lib/core/popen.c
+++ b/src/lib/core/popen.c
@@ -579,8 +579,8 @@ close_inherited_fds(int *skip_fds, size_t nr_skip_fds)
                if (fd_no == -1)
                        continue;
 
-               say_debug("popen: close inherited fd [%s:%d]", stdX_str(fd_no),
-                         fd_no);
+               say_debug("popen: close inherited fd [%s:%d]",
+                         stdX_str(fd_no), fd_no);
                if (close(fd_no)) {
                        int saved_errno = errno;
                        diag_set(SystemError, "fdin: Can't close %d", fd_no);


More information about the Tarantool-patches mailing list