csm...@debian.org wrote on Wed, 28 May 2014 07:04 +1000: > On Tue, May 27, 2014 at 11:43:38PM +0800, Bai Shi wrote: > > Do you mind to advice on the below statement. Does it wait for stat > > fail in purpose? > > > > if (stat(DEFAULT_PRELOAD, &ts) < 0 || S_ISREG(ts.st_mode)) > It does look a bit odd doesn't it? > If stat fails OR (stat doesn't fail AND its a regular file) > then load the file. > > I think it should be > if stat works AND its a regular file THEN load it, but ill check the > logic, there was some odd return value behaviour; perhaps a mandatory > presence of the config file.
Agreed. You want: if (stat(DEFAULT_PRELOAD, &ts) == 0 && S_ISREG(ts.st_mode)) { if (!Quiet) printf(_("* Applying %s ...\n"), DEFAULT_PRELOAD); rc |= Preload(DEFAULT_PRELOAD); } meaning: - if stat succeeds (e.g. /etc/sysctl.conf exists) - and it's a file, not a directory or symlink try to load it. -- Pete -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org