4 ms·
echo returns nonzero if it cannot write ... touch foo.txt; chmod 400 foo.txt; echo ouch > foo.txt; echo $? .., but it appears this asm returns zero always.
by tlholaday 10y ago
echo returns nonzero if it cannot write ...
touch foo.txt; chmod 400 foo.txt; echo ouch > foo.txt; echo $?
.., but it appears this asm returns zero always.
- tomjakubowski 10y agoHow do "raw" system calls pass back error information on Linux? errno is strictly a C/POSIX abstraction, right?
- dom0 10y agoThey just return the negative error number. Eg. -EINVAL.
- JoshTriplett 10y agoAnd for syscalls that also have a meaningful return value, the ABI requires that valid errno values fall in the range -1 to -4095, to disambiguate them from any possible return value. Those values can't conflict with valid userspace pointers (since they'd point into kernel space), and syscalls must not allow them to conflict with valid numeric return values.
- userbinator 10y ago...which I think is a far superior system to errno. I commented on this before somewhat recently: https://news.ycombinator.com/item?id=13062421 https://news.ycombinator.com/item?id=13062421 In fact, it's puzzling to me why the errno mechanism was even conceived, as it seems to offer no advantages over returning errors directly (does anyone happen to know?)