Re: [PATCH] state: check return value of chown

2021-01-05 Thread yeholmes
On Mon, 04 Jan 2021 20:20:58 -, Karl Palsson wrote: > This is akin to the classic problem of logging macros turning off > code. You need to introduce an extra variable for the assert to > check. (If you want to keep going down this path) Thank you very much for your 'junk' code :) I've tested

Re: [PATCH] state: check return value of chown

2021-01-04 Thread Karl Palsson
Daniel Golle wrote: > On Mon, Jan 04, 2021 at 05:08:22PM -, Karl Palsson wrote: > > > > Daniel Golle wrote: > > > On Sat, Jan 02, 2021 at 10:01:36PM +0800, yehol...@outlook.com > > > wrote: > > > > > > - chown(p->pw_dir, p->pw_uid, p->pw_gid); > > > > +

Re: [PATCH] state: check return value of chown

2021-01-04 Thread Daniel Golle
On Mon, Jan 04, 2021 at 05:08:22PM -, Karl Palsson wrote: > > Daniel Golle wrote: > > On Sat, Jan 02, 2021 at 10:01:36PM +0800, yehol...@outlook.com > > wrote: > > > > - chown(p->pw_dir, p->pw_uid, p->pw_gid); > > > + if (chown(p->pw_dir, p->pw_uid,

Re: [PATCH] state: check return value of chown

2021-01-04 Thread Karl Palsson
Daniel Golle wrote: > On Sat, Jan 02, 2021 at 10:01:36PM +0800, yehol...@outlook.com > wrote: > > - chown(p->pw_dir, p->pw_uid, p->pw_gid); > > + if (chown(p->pw_dir, p->pw_uid, p->pw_gid)) > > + fprintf(stderr, "Failed to change

[PATCH] state: check return value of chown

2021-01-02 Thread yeholmes
From: Ye Holmes wrap around chown with `assert, this avoids unused result warnings being treated as errors by prebuilt GCC (with glibc-2.31, version 10.2): procd-2020-12-12-7f12c89d/state.c: In function 'state_enter': procd-2020-12-12-7f12c89d/state.c:147:4: error: ignoring return value of

Re: [PATCH] state: check return value of chown

2021-01-02 Thread Daniel Golle
On Sat, Jan 02, 2021 at 10:01:36PM +0800, yehol...@outlook.com wrote: > From: Ye Holmes > > Output warning in case changing the ownership of ubus' home > directory has failed. Besides, this avoids treating unused > result warning as error by GCC (with glibc-2.31, version 10.2): > >

[PATCH] state: check return value of chown

2021-01-02 Thread yeholmes
From: Ye Holmes Output warning in case changing the ownership of ubus' home directory has failed. Besides, this avoids treating unused result warning as error by GCC (with glibc-2.31, version 10.2): procd-2020-12-12-7f12c89d/state.c: In function 'state_enter':