https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=232657

            Bug ID: 232657
           Summary: usr.sbin/sysrc: Return code 0 after failing to modify
                    a file
           Product: Base System
           Version: 11.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: misc
          Assignee: b...@freebsd.org
          Reporter: kwia...@panic.pl

To reproduce try to modify file in non existing directory:
$ sysrc -f ./nonexistent/testfile foo="bar"
/usr/sbin/sysrc: cannot create ./nonexistent/testfile: No such file or
directory
$ echo $?
0

The exit code is 0 while I was expecting to see ENOENT (2).

It's the same when I try to modify file that is not accessible:
$ sysrc -f /etc/rc.conf foo=bar
/usr/sbin/sysrc: cannot create /etc/rc.conf: Permission denied
$ echo $?
0

In this case EACCESS (13) should be returned.

I don't think that distinguishing these errors is needed. Returning anything
different than 0 should do the job.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to