forked from pool/util-linux
40 lines
1.4 KiB
Diff
40 lines
1.4 KiB
Diff
|
Index: util-linux-2.12r/disk-utils/mkswap.c
|
||
|
===================================================================
|
||
|
--- util-linux-2.12r.orig/disk-utils/mkswap.c
|
||
|
+++ util-linux-2.12r/disk-utils/mkswap.c
|
||
|
@@ -645,7 +645,7 @@ main(int argc, char ** argv) {
|
||
|
usage();
|
||
|
}
|
||
|
|
||
|
- DEV = open(device_name,O_RDWR);
|
||
|
+ DEV = open(device_name, O_RDWR | O_EXCL);
|
||
|
if (DEV < 0 || fstat(DEV, &statbuf) < 0) {
|
||
|
perror(device_name);
|
||
|
exit(1);
|
||
|
Index: util-linux-2.12r/disk-utils/mkfs.minix.c
|
||
|
===================================================================
|
||
|
--- util-linux-2.12r.orig/disk-utils/mkfs.minix.c
|
||
|
+++ util-linux-2.12r/disk-utils/mkfs.minix.c
|
||
|
@@ -699,7 +699,7 @@ main(int argc, char ** argv) {
|
||
|
tmp += dirsize;
|
||
|
*(short *)tmp = 2;
|
||
|
strcpy(tmp+2,".badblocks");
|
||
|
- DEV = open(device_name,O_RDWR );
|
||
|
+ DEV = open(device_name,O_RDWR | O_EXCL);
|
||
|
if (DEV<0)
|
||
|
die(_("unable to open %s"));
|
||
|
if (fstat(DEV,&statbuf)<0)
|
||
|
Index: util-linux-2.12r/disk-utils/mkfs.bfs.c
|
||
|
===================================================================
|
||
|
--- util-linux-2.12r.orig/disk-utils/mkfs.bfs.c
|
||
|
+++ util-linux-2.12r/disk-utils/mkfs.bfs.c
|
||
|
@@ -170,7 +170,7 @@ main(int argc, char *argv[]) {
|
||
|
if (!S_ISBLK(statbuf.st_mode))
|
||
|
fatal(_("%s is not a block special device"), device);
|
||
|
|
||
|
- fd = open(device, O_RDWR);
|
||
|
+ fd = open(device, O_RDWR | O_EXCL);
|
||
|
if (fd == -1) {
|
||
|
perror(device);
|
||
|
fatal(_("cannot open %s"), device);
|