aboutsummaryrefslogtreecommitdiffstats
path: root/unix/syslinux.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/syslinux.c')
-rw-r--r--unix/syslinux.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/unix/syslinux.c b/unix/syslinux.c
index 276990da..32e9dded 100644
--- a/unix/syslinux.c
+++ b/unix/syslinux.c
@@ -104,25 +104,24 @@ void __attribute__((noreturn)) die(const char *msg)
*/
ssize_t xpread(int fd, void *buf, size_t count, off_t offset)
{
- char *p = buf;
+ char *bufp = (char *)buf;
ssize_t rv;
ssize_t done = 0;
while ( count ) {
- rv = pread(fd, p, count, offset);
+ rv = pread(fd, bufp, count, offset);
if ( rv == 0 ) {
die("short read");
} else if ( rv == -1 ) {
if ( errno == EINTR ) {
continue;
} else {
- perror(program);
- exit(1);
+ die(strerror(errno));
}
} else {
+ bufp += rv;
offset += rv;
done += rv;
- p += rv;
count -= rv;
}
}
@@ -132,25 +131,24 @@ ssize_t xpread(int fd, void *buf, size_t count, off_t offset)
ssize_t xpwrite(int fd, const void *buf, size_t count, off_t offset)
{
- const char *p = buf;
+ const char *bufp = (const char *)buf;
ssize_t rv;
ssize_t done = 0;
while ( count ) {
- rv = pwrite(fd, p, count, offset);
+ rv = pwrite(fd, bufp, count, offset);
if ( rv == 0 ) {
die("short write");
} else if ( rv == -1 ) {
if ( errno == EINTR ) {
continue;
} else {
- perror(program);
- exit(1);
+ die(strerror(errno));
}
} else {
+ bufp += rv;
offset += rv;
done += rv;
- p += rv;
count -= rv;
}
}