Open devices RDONLY for ioctls. That makes it work on open devices to which

GEOM doesn't allow WR access.
This commit is contained in:
Søren Schmidt 2005-06-06 20:46:51 +00:00
parent 7217408a65
commit 265fa8db1d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=147063

View File

@ -307,7 +307,7 @@ main(int argc, char **argv)
exit(EX_USAGE);
}
sprintf(device, "/dev/%s", argv[2]);
if ((fd = open(device, O_RDWR)) < 0)
if ((fd = open(device, O_RDONLY)) < 0)
err(1, "device not found");
if (argc == 4) {
mode = str2mode(argv[3]);
@ -334,7 +334,7 @@ main(int argc, char **argv)
exit(EX_USAGE);
}
sprintf(device, "/dev/%s", argv[2]);
if ((fd = open(device, O_RDWR)) < 0)
if ((fd = open(device, O_RDONLY)) < 0)
err(1, "device not found");
ata_cap_print(fd);
exit(EX_OK);