NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/48829: vnconfig(8) -c returns success on non-existing regular_file



>Number:         48829
>Category:       bin
>Synopsis:       vnconfig(8) -c returns success on non-existing regular_file
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 21 20:35:00 +0000 2014
>Originator:     Thomas Schmitt
>Release:        6.1.3
>Organization:
>Environment:
NetBSD netbsd 6.1.3 NetBSD 6.1.3 (GENERIC) i386
>Description:
If the regular_file data source cannot be opened, vnconfig(8) prints an
error message but exits 0 nevertheless.
  
  netbsd# vnconfig -c vnd0 /my/wrong/path && echo Success
  vnconfig: /my/wrong/path: No such file or directory
  Success
  netbsd#

One cannot do anything with /dev/vnd0 afterwards.
Not even give it up
  
  netbsd# vnconfig -u vnd0
  vnconfig: /dev/rvnd0d: VNDIOCCLR: Device not configured

Code inspection reveils that function config() in
  /usr/src/usr.sbin/vnconfig/vnconfig.c
does nothing else but cleaning up if this happens.

(For building vnconfig, i had to do
   netbsd# cp /usr/src/sys/sys/bitops.h /usr/include/sys/bitops.h
 because of errors like this
   vnconfig.c:182:4: error: implicit declaration of function '__BITMAP_TYPE'
)

>How-To-Repeat:
netbsd# vnconfig -c vnd0 /my/wrong/path && echo Success

>Fix:
The error case for open(file, ...) in vnconfig.c should set the variable
"rv" to -1, like a failed ioctl() would do.

I will send a patch proposal.

After the change, expect

  netbsd# ./vnconfig -c vnd0 /my/wrong/path && echo Success
  vnconfig: /my/wrong/path: No such file or directory
  netbsd#



Home | Main Index | Thread Index | Old Index