summaryrefslogtreecommitdiffstats
path: root/usr.sbin/burncd/burncd.c
diff options
context:
space:
mode:
authorpb <pb@FreeBSD.org>2003-07-26 12:14:58 +0000
committerpb <pb@FreeBSD.org>2003-07-26 12:14:58 +0000
commitff06e11f55b078d207649db47d71c18f83d20d50 (patch)
tree947439b0ea48ac25f89c259fd659c386ac928fab /usr.sbin/burncd/burncd.c
parentef09742d0b0afbee1af059f27bb0ab66a4e95054 (diff)
downloadFreeBSD-src-ff06e11f55b078d207649db47d71c18f83d20d50.zip
FreeBSD-src-ff06e11f55b078d207649db47d71c18f83d20d50.tar.gz
Fix "write from stdin".
Reviewed by: sos MFC after: 1 week
Diffstat (limited to 'usr.sbin/burncd/burncd.c')
-rw-r--r--usr.sbin/burncd/burncd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/burncd/burncd.c b/usr.sbin/burncd/burncd.c
index 95a681c..5878d9b 100644
--- a/usr.sbin/burncd/burncd.c
+++ b/usr.sbin/burncd/burncd.c
@@ -611,8 +611,10 @@ write_file(int fd, struct track_info *track_info)
size = 0;
while ((count = read(track_info->file, buf,
- MIN((track_info->file_size - size),
- track_info->block_size * BLOCKS))) > 0) {
+ track_info->file_size == -1
+ ? track_info->block_size * BLOCKS
+ : MIN((track_info->file_size - size),
+ track_info->block_size * BLOCKS))) > 0) {
int res;
if (count % track_info->block_size) {
@@ -641,7 +643,8 @@ write_file(int fd, struct track_info *track_info)
fprintf(stderr, " total %jd KB\r",
(intmax_t)tot_size / 1024);
}
- if (size >= track_info->file_size)
+ if (track_info->file_size != -1
+ && size >= track_info->file_size)
break;
}
OpenPOWER on IntegriCloud