[Toybox] [PATCH] nohup: use the same mode constant for open() and xcreate().

Rob Landley rob at landley.net
Tue Jan 31 20:46:24 PST 2023


On 1/31/23 10:33, enh via Toybox wrote:
> The open() call was the only remaining use of the named permission
> constants, and the equivalent permissions are given in octal just
> a couple of lines later. This seems like a solid entry for the next
> toybox release's pedantry award.

I applied this, but FYI the constant == function() stuff is so a typoed
assignment instead of comparison barfs with not-an-lvalue. It's a style thing
where an assignment not only _can't_ silently drop in for a comparison, and is
also more easily visually distinguished. (If constant is on the left it can only
be a comparison.)

Serves a purpose. In this case you can't assign to a function return value, but
*function() happens too, and the warning unless it has parentheses isn't a
strong defense either because a&b || c also needs parentheses so they tend to
happen...

Otherwise they're theoretically equivalent, so changing it to be the other way
because it "looks wrong" otherwise... seems weird to me? It looks like it
couldn't be an assignment. That's the point...

Rob


More information about the Toybox mailing list