View | Details | Raw Unified | Return to bug 229616 | Differences between
and this patch

Collapse All | Expand All

(-)args.c (+1 lines)
Lines 320-325 Link Here
320
	{ "ascii",	C_ASCII,	C_EBCDIC,	e2a_POSIX },
320
	{ "ascii",	C_ASCII,	C_EBCDIC,	e2a_POSIX },
321
	{ "block",	C_BLOCK,	C_UNBLOCK,	NULL },
321
	{ "block",	C_BLOCK,	C_UNBLOCK,	NULL },
322
	{ "ebcdic",	C_EBCDIC,	C_ASCII,	a2e_POSIX },
322
	{ "ebcdic",	C_EBCDIC,	C_ASCII,	a2e_POSIX },
323
	{ "fsync",	C_FSYNC,	0,		NULL},
323
	{ "ibm",	C_EBCDIC,	C_ASCII,	a2ibm_POSIX },
324
	{ "ibm",	C_EBCDIC,	C_ASCII,	a2ibm_POSIX },
324
	{ "lcase",	C_LCASE,	C_UCASE,	NULL },
325
	{ "lcase",	C_LCASE,	C_UCASE,	NULL },
325
	{ "noerror",	C_NOERROR,	0,		NULL },
326
	{ "noerror",	C_NOERROR,	0,		NULL },
(-)dd.1 (+8 lines)
Lines 252-257 Link Here
252
and
252
and
253
.No pre- Ns Bx 4.3 reno
253
.No pre- Ns Bx 4.3 reno
254
systems.
254
systems.
255
.It Cm fsync
256
Call
257
.Xr fsync 2
258
on the output before
259
.Xr close 2
260
to ensure it is on stable storage when
261
.Nm
262
exits.
255
.It Cm lcase
263
.It Cm lcase
256
Transform uppercase characters into lowercase characters.
264
Transform uppercase characters into lowercase characters.
257
.It Cm pareven , parnone , parodd , parset
265
.It Cm pareven , parnone , parodd , parset
(-)dd.c (-2 / +17 lines)
Lines 119-130 Link Here
119
119
120
	dd_close();
120
	dd_close();
121
	/*
121
	/*
122
	 * If output is stdout, it may be shared with another process,
123
	 * leading to close(2) merely decrementing a reference count.
124
	 *
125
	 * This could mask errors it would otherwise have reported.
126
	 */
127
	if ((ddflags & C_FSYNC || out.fd == STDOUT_FILENO) &&
128
	    fsync(out.fd) == -1 && errno != EINVAL) {
129
		err(1, "fsync");
130
	}
131
	/*
122
	 * Some devices such as cfi(4) may perform significant amounts
132
	 * Some devices such as cfi(4) may perform significant amounts
123
	 * of work when a write descriptor is closed.  Close the out
133
	 * of work when a write descriptor is closed.  Close the out
124
	 * descriptor explicitly so that the summary handler (called
134
	 * descriptor explicitly so that the summary handler (called
125
	 * from an atexit() hook) includes this work.
135
	 * from an atexit() hook) includes this work.
136
	 *
137
	 * As implied by this work, close(2) may fail, so ensure we
138
	 * report any such errors.
126
	 */
139
	 */
127
	close(out.fd);
140
	if (close(out.fd) == -1 && errno != EINTR) {
141
		err(1, "close");
142
	}
128
	exit(0);
143
	exit(0);
129
}
144
}
130
145
Lines 163-169 Link Here
163
	if (files_cnt > 1 && !(in.flags & ISTAPE))
178
	if (files_cnt > 1 && !(in.flags & ISTAPE))
164
		errx(1, "files is not supported for non-tape devices");
179
		errx(1, "files is not supported for non-tape devices");
165
180
166
	cap_rights_set(&rights, CAP_FTRUNCATE, CAP_IOCTL, CAP_WRITE);
181
	cap_rights_set(&rights, CAP_FSYNC, CAP_FTRUNCATE, CAP_IOCTL, CAP_WRITE);
167
	if (out.name == NULL) {
182
	if (out.name == NULL) {
168
		/* No way to check for read access here. */
183
		/* No way to check for read access here. */
169
		out.fd = STDOUT_FILENO;
184
		out.fd = STDOUT_FILENO;
(-)dd.h (+1 lines)
Lines 101-106 Link Here
101
#define	C_NOXFER	0x10000000
101
#define	C_NOXFER	0x10000000
102
#define	C_NOINFO	0x20000000
102
#define	C_NOINFO	0x20000000
103
#define	C_PROGRESS	0x40000000
103
#define	C_PROGRESS	0x40000000
104
#define	C_FSYNC		0x80000000
104
105
105
#define	C_PARITY	(C_PAREVEN | C_PARODD | C_PARNONE | C_PARSET)
106
#define	C_PARITY	(C_PAREVEN | C_PARODD | C_PARNONE | C_PARSET)
106
107

Return to bug 229616