Oops, I did not check the return value of fstat. Good catch.
But when I tested my change without yours, disklabel did not abort. Why then does opendev need to occur before the pledge? Is there another usage of disklabel that causes a different failure pattern?
On 05/28/2016 11:31 AM, Theo de Raadt wrote:
If you try to run disklabel(8) on a file that is not a device, it aborts aborts for want of pledge("ioctl"). This diff prints an error message and exits cleanly. I return exit code 1 but note that sometimes disklabel returns 4; the man page doesn't explain the distinction anywhere. $ disklabel / Abort trap (core dumped) $ obj/disklabel / disklabel: / is not a deviceIndeed your diff is also needed on top of mine. Let's try this.
