summaryrefslogtreecommitdiffstats
path: root/bin/dd/dd.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2000-05-24 06:47:10 +0000
committerobrien <obrien@FreeBSD.org>2000-05-24 06:47:10 +0000
commitf84c12deda673f8103d06563efebe0bc6b83b1ac (patch)
tree2c5a8b2e1e2640b77e1146e9889f1e0f76777276 /bin/dd/dd.c
parentaf0a4a05919dddcf5cce05fe0a35da5187148d19 (diff)
downloadFreeBSD-src-f84c12deda673f8103d06563efebe0bc6b83b1ac.zip
FreeBSD-src-f84c12deda673f8103d06563efebe0bc6b83b1ac.tar.gz
Fix ``dd if=/dev/zero of=/dev/daN'' on the Alpha by allowing the label
to be overwritten. Submitted by: green
Diffstat (limited to 'bin/dd/dd.c')
-rw-r--r--bin/dd/dd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/dd/dd.c b/bin/dd/dd.c
index 97613f5..937379f 100644
--- a/bin/dd/dd.c
+++ b/bin/dd/dd.c
@@ -52,6 +52,7 @@ static const char rcsid[] =
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/conf.h>
+#include <sys/disklabel.h>
#include <sys/filio.h>
#include <ctype.h>
@@ -218,8 +219,14 @@ getfdtype(io)
} else {
if (type & D_TAPE)
io->flags |= ISTAPE;
- else if (type & (D_DISK | D_MEM))
+ else if (type & (D_DISK | D_MEM)) {
+ if (type & D_DISK) {
+ const int one = 1;
+
+ (void)ioctl(io->fd, DIOCWLABEL, &one);
+ }
io->flags |= ISSEEK;
+ }
if (S_ISCHR(sb.st_mode) && (type & D_TAPE) == 0)
io->flags |= ISCHR;
}
OpenPOWER on IntegriCloud