diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2009-02-10 03:13:21 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2009-02-10 03:13:21 +0000 |
commit | dfc32f192d11a025067185ed9811d5237deeab61 (patch) | |
tree | f6cda97bac4a1a8d3b83f999c5b4c1eaf6d3dc82 /sys/arch/sgi | |
parent | d5b4232d19137a24cc746d3c77808408444195c5 (diff) |
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@
Diffstat (limited to 'sys/arch/sgi')
-rw-r--r-- | sys/arch/sgi/stand/sgivol/sgivol.c | 10 |
1 files changed, 6 insertions, 4 deletions
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); |