more of the same: $ ktrace ncheck_ffs /dev/tty Abort trap (core dumped) $ kdump | tail 65350 ncheck_ffs CALL open(0xd76b761d460,0<O_RDONLY>) 65350 ncheck_ffs NAMI "/dev/tty" 65350 ncheck_ffs RET open 3 65350 ncheck_ffs CALL fstat(3,0x7f7ffffef100) 65350 ncheck_ffs STRU struct stat { dev=1040, ino=1280, mode=crw-rw-rw- , nlink=1, uid=0<"root">, gid=0<"wheel">, rdev=256, atime=1464476868<"May 29 01:07:48 2016">.691119578, mtime=1464466717<"May 28 22:18:37 2016">.835647187, ctime=1464466717<"May 28 22:18:37 2016">.835647187, size=0, blocks=0, blksize=65536, flags=0x0, gen=0x0 } 65350 ncheck_ffs RET fstat 0 65350 ncheck_ffs CALL ioctl(3,DIOCGDINFO,0xd76b7623100) 65350 ncheck_ffs PLDG ioctl, "ioctl", errno 1 Operation not permitted 65350 ncheck_ffs PSIG SIGABRT SIG_DFL 65350 ncheck_ffs NAMI "ncheck_ffs.core"
remove the early pledge and leave the pledge "stdio" right after DIOCGDINFO. Index: ncheck_ffs.c =================================================================== RCS file: /var/cvs/src/sbin/ncheck_ffs/ncheck_ffs.c,v retrieving revision 1.52 diff -u -p -r1.52 ncheck_ffs.c --- ncheck_ffs.c 23 Nov 2015 19:19:30 -0000 1.52 +++ ncheck_ffs.c 28 May 2016 23:16:37 -0000 @@ -510,9 +510,6 @@ main(int argc, char *argv[]) char *ep; int c, i; - if (pledge("stdio rpath disklabel", NULL) == -1) - err(1, "pledge"); - while ((c = getopt(argc, argv, "af:i:ms")) != -1) switch (c) { case 'a':