diff options
author | kuriyama <kuriyama@FreeBSD.org> | 1999-02-27 12:08:02 +0000 |
---|---|---|
committer | kuriyama <kuriyama@FreeBSD.org> | 1999-02-27 12:08:02 +0000 |
commit | 6df3a4da61c19f60c3a5011b1e9d3206bf2ca36b (patch) | |
tree | ce05c635933979d1dfa1fd011278e76b2d113b48 /usr.sbin/pccard/pccardc/wrattr.c | |
parent | d7bc8dbf1830427d3489834768adce4d7ce43f83 (diff) | |
download | FreeBSD-src-6df3a4da61c19f60c3a5011b1e9d3206bf2ca36b.zip FreeBSD-src-6df3a4da61c19f60c3a5011b1e9d3206bf2ca36b.tar.gz |
Cleanup usage of err() and warn().
Add error handling for ioctl().
Reviewed by: -current
Obtained from: PAO
Diffstat (limited to 'usr.sbin/pccard/pccardc/wrattr.c')
-rw-r--r-- | usr.sbin/pccard/pccardc/wrattr.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/pccard/pccardc/wrattr.c b/usr.sbin/pccard/pccardc/wrattr.c index e7857b9..51b57bc 100644 --- a/usr.sbin/pccard/pccardc/wrattr.c +++ b/usr.sbin/pccard/pccardc/wrattr.c @@ -26,7 +26,7 @@ #ifndef lint static const char rcsid[] = - "$Id: wrattr.c,v 1.10 1997/11/18 21:08:08 nate Exp $"; + "$Id: wrattr.c,v 1.11 1999/02/05 16:00:16 kuriyama Exp $"; #endif /* not lint */ #include <err.h> @@ -62,16 +62,19 @@ wrattr_main(argc, argv) fd = open(name, O_RDWR); if (fd < 0) err(1, "%s", name); + reg = MDF_ATTR; if (ioctl(fd, PIOCRWFLAG, ®)) err(1, "ioctl (PIOCRWFLAG)"); + if (sscanf(argv[2], "%x", ®) != 1 || sscanf(argv[3], "%x", &value) != 1) errx(1, "arg error"); + offs = reg; c = value; lseek(fd, offs, SEEK_SET); if (write(fd, &c, 1) != 1) - warn("%s", name); + err(1, "%s", name); return 0; } |