aboutsummaryrefslogtreecommitdiffstats
path: root/mtools/syslinux.c
diff options
context:
space:
mode:
Diffstat (limited to 'mtools/syslinux.c')
-rwxr-xr-xmtools/syslinux.c59
1 files changed, 1 insertions, 58 deletions
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,