diff options
author | Nicolas Cornu <ncornu@aldebaran.com> | 2015-11-10 14:51:04 +0100 |
---|---|---|
committer | Paulo Alcantara <pcacjr@zytor.com> | 2015-11-10 20:02:11 -0200 |
commit | b8251024ac0635ec025886f71f3e065886c9cef4 (patch) | |
tree | 4a708d3ec1b9003f256e135b5424a4daad686650 | |
parent | e2ba978566e44c976919b0382d3b185e9ef0db1f (diff) | |
download | syslinux-b8251024ac0635ec025886f71f3e065886c9cef4.tar.gz |
mtools: Remove local xpread/xpwrite, use ones from syslxcom
Signed-off-by: Nicolas Cornu <ncornu@aldebaran.com>
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
-rwxr-xr-x | mtools/Makefile | 1 | ||||
-rwxr-xr-x | mtools/syslinux.c | 59 |
2 files changed, 2 insertions, 58 deletions
diff --git a/mtools/Makefile b/mtools/Makefile index 0d0b1b27..c9804209 100755 --- a/mtools/Makefile +++ b/mtools/Makefile @@ -9,6 +9,7 @@ SRCS = syslinux.c \ ../libinstaller/fs.c \ ../libinstaller/syslxmod.c \ ../libinstaller/syslxopt.c \ + ../libinstaller/syslxcom.c \ ../libinstaller/setadv.c \ ../libinstaller/bootsect_bin.c \ ../libinstaller/ldlinux_bin.c \ diff --git a/mtools/syslinux.c b/mtools/syslinux.c index 59244307..3686be0a 100755 --- a/mtools/syslinux.c +++ b/mtools/syslinux.c @@ -42,8 +42,8 @@ #include "setadv.h" #include "syslxopt.h" #include "syslxfs.h" +#include "syslxcom.h" -char *program; /* Name of program */ pid_t mypid; void __attribute__ ((noreturn)) die(const char *msg) @@ -59,63 +59,6 @@ void __attribute__ ((noreturn)) die_err(const char *msg) } /* - * read/write wrapper functions - */ -ssize_t xpread(int fd, void *buf, size_t count, off_t offset) -{ - char *bufp = (char *)buf; - ssize_t rv; - ssize_t done = 0; - - while (count) { - rv = pread(fd, bufp, count, offset); - if (rv == 0) { - die("short read"); - } else if (rv == -1) { - if (errno == EINTR) { - continue; - } else { - die(strerror(errno)); - } - } else { - bufp += rv; - offset += rv; - done += rv; - count -= rv; - } - } - - return done; -} - -ssize_t xpwrite(int fd, const void *buf, size_t count, off_t offset) -{ - const char *bufp = (const char *)buf; - ssize_t rv; - ssize_t done = 0; - - while (count) { - rv = pwrite(fd, bufp, count, offset); - if (rv == 0) { - die("short write"); - } else if (rv == -1) { - if (errno == EINTR) { - continue; - } else { - die(strerror(errno)); - } - } else { - bufp += rv; - offset += rv; - done += rv; - count -= rv; - } - } - - return done; -} - -/* * Version of the read function suitable for libfat */ int libfat_xpread(intptr_t pp, void *buf, size_t secsize, |