Re: [patch] Fix file descriptor leak in nohup.c

2018-09-08 Thread Nan Xiao
Hi bluhm, Thanks for your reply! Honestly, I am still a little confused: > But before you plugged the fd leak, "nohup true 2>&-" would write to nohup.out. "nohup true 2>&-" means close stderr of nohup, right? > errno = 0; > if (isatty(STDOUT_FILENO) || errno == EBADF) Since we close stderr,

Re: [patch] Fix file descriptor leak in nohup.c

2018-09-08 Thread Alexander Bluhm
On Sat, Sep 08, 2018 at 08:47:28PM +0800, Nan Xiao wrote: > I don't think need "if (fd > STDERR_FILENO)" cause the fd is a new > opened file descriptor. If its value is less or equal than > `STDERR_FILENO', it means the stdin or stderr is already closed > intentionally. So it should be OK close fd

Re: pfctl: error out early on bad anchor usage

2018-09-08 Thread Alexandr Nedvedicky
On Sat, Sep 08, 2018 at 02:35:04PM +0200, Klemens Nanni wrote: > Updated diff using `mode' so the intent is even clearer now that I also > merged my next diff: > > Fail much earlier when trying to write anchors beginning with "_". > This avoids the duplicate check as well as everything between

Re: [patch] rebound: add NULL pointer checks

2018-09-08 Thread Anton Lindqvist
On Sat, Sep 08, 2018 at 11:48:35AM +0200, Clemens Goessnitzer wrote: > > > On 08/09/18 11:40, Theo Buehler wrote: > > On Sat, Sep 08, 2018 at 11:07:30AM +0200, Anton Lindqvist wrote: > > > On Fri, Sep 07, 2018 at 09:22:33PM +0200, Theo Buehler wrote: > > > > On Fri, Sep 07, 2018 at 09:15:30PM

Re: [patch] Fix file descriptor leak in nohup.c

2018-09-08 Thread Nan Xiao
Hi bluhm, I don't think need "if (fd > STDERR_FILENO)" cause the fd is a new opened file descriptor. If its value is less or equal than `STDERR_FILENO', it means the stdin or stderr is already closed intentionally. So it should be OK close fd again. Thanks! On 9/8/2018 8:26 PM, Alexander Bluhm

Re: pfctl: error out early on bad anchor usage

2018-09-08 Thread Klemens Nanni
Updated diff using `mode' so the intent is even clearer now that I also merged my next diff: Fail much earlier when trying to write anchors beginning with "_". This avoids the duplicate check as well as everything between parsing the anchor name and `-F'/`-s' arguments. OK? Index: pfctl.c

Re: [patch] Fix file descriptor leak in nohup.c

2018-09-08 Thread Alexander Bluhm
On Sat, Sep 08, 2018 at 11:05:15AM +0800, Nan Xiao wrote: > The following patch fixes file descriptor leak in `dofile' function. > Sorry if I am wrong, thanks! It is a leak. > @@ -125,6 +125,7 @@ dupit: > (void)lseek(fd, (off_t)0, SEEK_END); > if (dup2(fd, STDOUT_FILENO) == -1) >

Use proper *_free function in OBJ_add_object()

2018-09-08 Thread Theo Buehler
ASN1_OBJECTs should be freed with ASN1_OBJECT_free(3), not with free(3). 292 int 293 OBJ_add_object(const ASN1_OBJECT *obj) 294 { 295 ASN1_OBJECT *o; Index: objects/obj_dat.c === RCS file:

pfctl: error on incomplete anchor usage

2018-09-08 Thread Klemens Nanni
`pfctl -a foo' exits 0; "foo" does not exist. Let's implement what's acutally documented: -a anchor Apply flags -f, -F, and -s only to the rules in the specified anchor. Suggestions for a better warning? OK? Index: pfctl.c

Re: [patch] rebound: add NULL pointer checks

2018-09-08 Thread Clemens Goessnitzer
On 08/09/18 11:40, Theo Buehler wrote: On Sat, Sep 08, 2018 at 11:07:30AM +0200, Anton Lindqvist wrote: On Fri, Sep 07, 2018 at 09:22:33PM +0200, Theo Buehler wrote: On Fri, Sep 07, 2018 at 09:15:30PM +0200, Clemens Goessnitzer wrote: This patch adds 2 missing NULL pointer checks to

Re: [patch] rebound: add NULL pointer checks

2018-09-08 Thread Theo Buehler
On Sat, Sep 08, 2018 at 11:07:30AM +0200, Anton Lindqvist wrote: > On Fri, Sep 07, 2018 at 09:22:33PM +0200, Theo Buehler wrote: > > On Fri, Sep 07, 2018 at 09:15:30PM +0200, Clemens Goessnitzer wrote: > > > This patch adds 2 missing NULL pointer checks to rebound.c after malloc(). > > > > The

Re: [patch] rebound: add NULL pointer checks

2018-09-08 Thread Anton Lindqvist
On Fri, Sep 07, 2018 at 09:22:33PM +0200, Theo Buehler wrote: > On Fri, Sep 07, 2018 at 09:15:30PM +0200, Clemens Goessnitzer wrote: > > This patch adds 2 missing NULL pointer checks to rebound.c after malloc(). > > The same function also contains an unchecked calloc. Since it's a daemon I guess

Re: csh: simplify strsave()

2018-09-08 Thread Martijn van Duren
On 09/08/18 04:57, Michael Mikonos wrote: > Hello, > > The function strsave() in csh(1) is practically strdup(3). > The only difference is memory allocation failure results in > calling the stderror() error handler, which will later exit. > This patch makes the code (IMO) clearer by removing two