From dfc32f192d11a025067185ed9811d5237deeab61 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Tue, 10 Feb 2009 03:13:21 +0000 Subject: Unbreak sgivol. When writing to the raw device use the native blocksize. Whilst here, check the return value of fread() and improve error messages. ok krw@ miod@ --- sys/arch/sgi/stand/sgivol/sgivol.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sys/arch/sgi') diff --git a/sys/arch/sgi/stand/sgivol/sgivol.c b/sys/arch/sgi/stand/sgivol/sgivol.c index cd8d2e9ceaf..8120d3bad20 100644 --- a/sys/arch/sgi/stand/sgivol/sgivol.c +++ b/sys/arch/sgi/stand/sgivol/sgivol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sgivol.c,v 1.12 2008/08/25 14:53:34 jsing Exp $ */ +/* $OpenBSD: sgivol.c,v 1.13 2009/02/10 03:13:20 jsing Exp $ */ /* $NetBSD: sgivol.c,v 1.8 2003/11/08 04:59:00 sekiya Exp $ */ /*- @@ -422,10 +422,12 @@ write_file(void) i = st.st_size; fp = fopen(ufilename, "r"); while (i > 0) { + bzero(fbuf, fbufsize); fsize = i > fbufsize ? fbufsize : i; - fread(fbuf, 1, fsize, fp); - if (write(fd, fbuf, fsize) != fsize) - err(1, "write file"); + if (fread(fbuf, 1, fsize, fp) != fsize) + err(1, "reading file from disk"); + if (write(fd, fbuf, fbufsize) != fbufsize) + err(1, "writing file to SGI volume header"); i -= fsize; } fclose(fp); -- cgit v1.2.3