View | Details | Raw Unified | Return to bug 185070
Collapse All | Expand All

(-)dd.c (+12 lines)
Lines 49-54 Link Here
49
#include <sys/stat.h>
49
#include <sys/stat.h>
50
#include <sys/conf.h>
50
#include <sys/conf.h>
51
#include <sys/disklabel.h>
51
#include <sys/disklabel.h>
52
#include <sys/disk.h>
52
#include <sys/filio.h>
53
#include <sys/filio.h>
53
#include <sys/time.h>
54
#include <sys/time.h>
54
55
Lines 469-474 Link Here
469
			if (nw <= 0) {
470
			if (nw <= 0) {
470
				if (nw == 0)
471
				if (nw == 0)
471
					errx(1, "%s: end of device", out.name);
472
					errx(1, "%s: end of device", out.name);
473
				if (errno == EINVAL){
474
					size_t sectorsz = 0;
475
					if (ioctl(out.fd, DIOCGSECTORSIZE , &sectorsz) == 0) { 
476
						if ( out.dbsz % sectorsz)
477
							errx(1, "bs=%zu: not a multiple of %s's sector size (%zu bytes)",
478
									out.dbsz, out.name, sectorsz);
479
						else if (cnt < sectorsz)
480
							errx(1, "%s: not a multiple of %s's sector size (%zu bytes)",
481
									in.name, out.name, sectorsz);
482
					}
483
				}
472
				if (errno != EINTR)
484
				if (errno != EINTR)
473
					err(1, "%s", out.name);
485
					err(1, "%s", out.name);
474
				nw = 0;
486
				nw = 0;

Return to bug 185070