]> git.wh0rd.org - dump.git/commitdiff
LFS fixes (explicit use of open64/etc)
authorStelian Pop <stelian@popies.net>
Fri, 27 Apr 2001 15:22:47 +0000 (15:22 +0000)
committerStelian Pop <stelian@popies.net>
Fri, 27 Apr 2001 15:22:47 +0000 (15:22 +0000)
12 files changed:
CHANGES
compat/include/compatlfs.h [new file with mode: 0644]
compat/lib/bylabel.c
config.h.in
configure
configure.in
dump.spec
dump/main.c
dump/tape.c
restore/main.c
restore/tape.c
rmt/rmt.c

diff --git a/CHANGES b/CHANGES
index c5fb0ca83b5fb36c5e1f0553d653edff2f14574d..984575db5d5c29529b852cacbf95fcf7a5f3eb0e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,4 @@
-$Id: CHANGES,v 1.112 2001/04/12 13:14:14 stelian Exp $
+$Id: CHANGES,v 1.113 2001/04/27 15:22:47 stelian Exp $
 
 Changes between versions 0.4b21 and 0.4b22 (released ????????????????)
 ======================================================================
 
 Changes between versions 0.4b21 and 0.4b22 (released ????????????????)
 ======================================================================
@@ -54,6 +54,11 @@ Changes between versions 0.4b21 and 0.4b22 (released ????????????????)
        3 file descriptors per dump process (and there is one dump
        process per tape).
 
        3 file descriptors per dump process (and there is one dump
        process per tape).
 
+11.    Fixed dump large file system support, by explicit use of
+       open64/lseek64/etc functions (explicit use needed because 
+       e2fsprogs libraries don't behave well when compiled with 
+       FILE_OFFSET_BITS=64).
+
 Changes between versions 0.4b20 and 0.4b21 (released January 13, 2001)
 ======================================================================
 
 Changes between versions 0.4b20 and 0.4b21 (released January 13, 2001)
 ======================================================================
 
diff --git a/compat/include/compatlfs.h b/compat/include/compatlfs.h
new file mode 100644 (file)
index 0000000..fef642d
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ *     Ported to Linux's Second Extended File System as part of the
+ *     dump and restore backup suit
+ *     Stelian Pop <pop@noos.fr> - AlcĂ´ve <www.alcove.fr>, 2000
+ *
+ *     $Id: compatlfs.h,v 1.1 2001/04/27 15:22:47 stelian Exp $
+ */
+
+/*-
+ * Copyright (c) 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _COMPATLFS_H_
+#define        _COMPATLFS_H_
+
+#include <config.h>
+
+#ifdef USE_LFS
+
+#define _LARGEFILE64_SOURCE
+#define OPEN open64
+#define LSEEK lseek64
+#define STAT stat64
+#define LSTAT lstat64
+#define FTRUNCATE ftruncate64
+
+#else
+
+#define OPEN open
+#define LSEEK lseek
+#define STAT stat
+#define LSTAT lstat
+#define FTRUNCATE ftruncate
+
+#endif /* USE_LFS */
+
+#endif /* !_COMPATLFS_H_ */
index 065d52985c5629ec810e53f2ae46953bf045b4c1..07f0dd92320ccb112b773a9eb54e44b1a826256c 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <config.h>
  */
 
 #include <config.h>
+#include <compatlfs.h>
 #include <stdio.h>
 #include <sys/param.h>
 #include <string.h>
 #include <stdio.h>
 #include <sys/param.h>
 #include <string.h>
@@ -55,11 +56,11 @@ get_label_uuid(const char *device, char **label, char *uuid) {
        int fd;
        struct ext2_super_block e2sb;
 
        int fd;
        struct ext2_super_block e2sb;
 
-       fd = open(device, O_RDONLY);
+       fd = OPEN(device, O_RDONLY);
        if (fd < 0)
                return 1;
 
        if (fd < 0)
                return 1;
 
-       if (lseek(fd, EXT2_SUPER_OFFSET, SEEK_SET) != EXT2_SUPER_OFFSET ||
+       if (LSEEK(fd, EXT2_SUPER_OFFSET, SEEK_SET) != EXT2_SUPER_OFFSET ||
            read(fd, (char *) &e2sb, EXT2_SUPER_SIZE) != EXT2_SUPER_SIZE ||
            ext2magic(e2sb) != EXT2_SUPER_MAGIC) {
                close(fd);
            read(fd, (char *) &e2sb, EXT2_SUPER_SIZE) != EXT2_SUPER_SIZE ||
            ext2magic(e2sb) != EXT2_SUPER_MAGIC) {
                close(fd);
index 311292a82e9af5162b090a626b67e80262581cbe..b483fce4cb74c4da90cce80c00aef9ffdab1e035 100644 (file)
@@ -54,8 +54,8 @@
 /* Define this is you want old style F script (no arguments) */
 #undef OLD_STYLE_FSCRIPT
 
 /* Define this is you want old style F script (no arguments) */
 #undef OLD_STYLE_FSCRIPT
 
-/* Define this to 64 if you want Large File System support */
-#undef _FILE_OFFSET_BITS
+/* Define this if you want Large File System support */
+#undef USE_LFS
 
 /* Define this if you have zlib compression library */
 #undef HAVE_ZLIB
 
 /* Define this if you have zlib compression library */
 #undef HAVE_ZLIB
index b4ce3b2020538bd425a7f6c0556c88a320238dac..958ddc7b21cbd4e23d2b586ac649105a707d7e48 100755 (executable)
--- a/configure
+++ b/configure
@@ -1402,7 +1402,7 @@ if test "${enable_largefile+set}" = set; then
   if test "$enableval" = "yes"
 then
        cat >> confdefs.h <<\EOF
   if test "$enableval" = "yes"
 then
        cat >> confdefs.h <<\EOF
-#define _FILE_OFFSET_BITS 64
+#define USE_LFS 1
 EOF
 
 fi
 EOF
 
 fi
index b5dd89cf92e2a5a2e5979bcd3e12378d0181c9a5..a7b608e18678df78c6282e54962a2baf6770685b 100644 (file)
@@ -129,7 +129,7 @@ AC_ARG_ENABLE([largefile],
 [  --enable-largefile         enable Large File System support (your glibc needs to support it)],
 if test "$enableval" = "yes"
 then
 [  --enable-largefile         enable Large File System support (your glibc needs to support it)],
 if test "$enableval" = "yes"
 then
-       AC_DEFINE(_FILE_OFFSET_BITS,64)
+       AC_DEFINE(USE_LFS)
 fi
 ,
 echo "Not enabling Large File System support"
 fi
 ,
 echo "Not enabling Large File System support"
index ef872e9866513a7f3e63abd750a7f17336988331..032ab05f9a63199a67fe83b77def211674be02bf 100644 (file)
--- a/dump.spec
+++ b/dump.spec
@@ -1,6 +1,6 @@
 %define        _sbindir /sbin
 # XXX --enable-kerberos                needs krcmd
 %define        _sbindir /sbin
 # XXX --enable-kerberos                needs krcmd
-%define        myoptions --with-binmode=6755 --with-manowner=root --with-mangrp=root --with-manmode=0644 --with-dumpdates="%{_sysconfdir}/dumpdates" --enable-readline
+%define        myoptions --with-binmode=6755 --with-manowner=root --with-mangrp=root --with-manmode=0644 --with-dumpdates="%{_sysconfdir}/dumpdates" --enable-readline --enable-largefile
 
 Summary: Programs for backing up and restoring filesystems.
 Name: dump
 
 Summary: Programs for backing up and restoring filesystems.
 Name: dump
index 0c896738608f9e8b318db313cd31a7a6262f84ab..82ff7f2e386e5f3dd3c161d9cb5ac6b1edc168f2 100644 (file)
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: main.c,v 1.47 2001/04/27 12:23:23 stelian Exp $";
+       "$Id: main.c,v 1.48 2001/04/27 15:22:47 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
 #endif /* not lint */
 
 #include <config.h>
+#include <compatlfs.h>
 #include <ctype.h>
 #include <compaterr.h>
 #include <fcntl.h>
 #include <ctype.h>
 #include <compaterr.h>
 #include <fcntl.h>
@@ -124,7 +125,7 @@ main(int argc, char *argv[])
        register int ch;
        int i, anydirskipped, bflag = 0, Tflag = 0, honorlevel = 1;
        dump_ino_t maxino;
        register int ch;
        int i, anydirskipped, bflag = 0, Tflag = 0, honorlevel = 1;
        dump_ino_t maxino;
-       struct stat statbuf;
+       struct STAT statbuf;
        dev_t filedev = 0;
 #ifdef __linux__
        errcode_t retval;
        dev_t filedev = 0;
 #ifdef __linux__
        errcode_t retval;
@@ -543,7 +544,7 @@ main(int argc, char *argv[])
                msg("The ENTIRE dump is aborted.\n");
                exit(X_STARTUP);
        }
                msg("The ENTIRE dump is aborted.\n");
                exit(X_STARTUP);
        }
-       if ((diskfd = open(disk, O_RDONLY)) < 0) {
+       if ((diskfd = OPEN(disk, O_RDONLY)) < 0) {
                msg("Cannot open %s\n", disk);
                msg("The ENTIRE dump is aborted.\n");
                exit(X_STARTUP);
                msg("Cannot open %s\n", disk);
                msg("The ENTIRE dump is aborted.\n");
                exit(X_STARTUP);
@@ -604,7 +605,7 @@ main(int argc, char *argv[])
 
        nonodump = spcl.c_level < honorlevel;
 
 
        nonodump = spcl.c_level < honorlevel;
 
-       if (!sizeest) {
+       if (!sizest) {
                msg("Label: %s\n", spcl.c_label);
 
                if (compressed)
                msg("Label: %s\n", spcl.c_label);
 
                if (compressed)
@@ -622,7 +623,7 @@ main(int argc, char *argv[])
        if (directory[0] == 0)
                anydirskipped = mapfiles(maxino, &tapesize);
        else {
        if (directory[0] == 0)
                anydirskipped = mapfiles(maxino, &tapesize);
        else {
-               if (stat(pathname, &statbuf) == -1) {
+               if (STAT(pathname, &statbuf) == -1) {
                        msg("File cannot be accessed (%s).\n", pathname);
                        msg("The ENTIRE dump is aborted.\n");
                        exit(X_STARTUP);
                        msg("File cannot be accessed (%s).\n", pathname);
                        msg("The ENTIRE dump is aborted.\n");
                        exit(X_STARTUP);
@@ -639,7 +640,7 @@ main(int argc, char *argv[])
                int anydirskipped2;
                char *p = *argv;
                /* check if file is available */
                int anydirskipped2;
                char *p = *argv;
                /* check if file is available */
-               if (stat(p, &statbuf) == -1) {
+               if (STAT(p, &statbuf) == -1) {
                        msg("File cannot be accessed (%s).\n", p);
                        msg("The ENTIRE dump is aborted.\n");
                        exit(X_STARTUP);
                        msg("File cannot be accessed (%s).\n", p);
                        msg("The ENTIRE dump is aborted.\n");
                        exit(X_STARTUP);
index cf1f5fbc4c6287eb02693aca60382d06d7acbddd..1464812010f5f3f74ebe043796651115d05ed69c 100644 (file)
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.44 2001/04/24 10:59:12 stelian Exp $";
+       "$Id: tape.c,v 1.45 2001/04/27 15:22:47 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
 #endif /* not lint */
 
 #include <config.h>
+#include <compatlfs.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <setjmp.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <setjmp.h>
@@ -547,7 +548,7 @@ trewind(void)
 #endif
                {
                        (void) close(tapefd);
 #endif
                {
                        (void) close(tapefd);
-                       while ((f = open(tape, 0)) < 0)
+                       while ((f = OPEN(tape, 0)) < 0)
                                sleep (10);
                        (void) close(f);
                }
                                sleep (10);
                        (void) close(f);
                }
@@ -861,10 +862,10 @@ restore_check_point:
 #ifdef RDUMP
                while ((tapefd = (host ? rmtopen(tape, 2) : pipeout ? 
                        fileno(stdout) : 
 #ifdef RDUMP
                while ((tapefd = (host ? rmtopen(tape, 2) : pipeout ? 
                        fileno(stdout) : 
-                       open(tape, O_WRONLY|O_CREAT, 0666))) < 0)
+                       OPEN(tape, O_WRONLY|O_CREAT, 0666))) < 0)
 #else
                while ((tapefd = (pipeout ? fileno(stdout) :
 #else
                while ((tapefd = (pipeout ? fileno(stdout) :
-                                 open(tape, O_RDWR|O_CREAT, 0666))) < 0)
+                                 OPEN(tape, O_RDWR|O_CREAT, 0666))) < 0)
 #endif
                    {
                        msg("Cannot open output \"%s\".\n", tape);
 #endif
                    {
                        msg("Cannot open output \"%s\".\n", tape);
@@ -1062,7 +1063,7 @@ doslave(int cmd, int slave_number)
         * Need our own seek pointer.
         */
        (void) close(diskfd);
         * Need our own seek pointer.
         */
        (void) close(diskfd);
-       if ((diskfd = open(disk, O_RDONLY)) < 0)
+       if ((diskfd = OPEN(disk, O_RDONLY)) < 0)
                quit("slave couldn't reopen disk: %s\n", strerror(errno));
 #ifdef __linux__
        ext2fs_close(fs);
                quit("slave couldn't reopen disk: %s\n", strerror(errno));
 #ifdef __linux__
        ext2fs_close(fs);
index 09aa8c7b4fed75cbf54e2be292fd9c47ff9dc706..2a261f6f1bc80088200d444a76472aadbb2e3a5b 100644 (file)
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: main.c,v 1.23 2001/04/26 08:59:32 stelian Exp $";
+       "$Id: main.c,v 1.24 2001/04/27 15:22:47 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
 #endif /* not lint */
 
 #include <config.h>
+#include <compatlfs.h>
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <errno.h>
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <errno.h>
@@ -315,14 +316,14 @@ main(int argc, char *argv[])
         * Compare contents of tape.
         */
        case 'C': {
         * Compare contents of tape.
         */
        case 'C': {
-               struct stat stbuf;
+               struct STAT stbuf;
 
                Vprintf(stdout, "Begin compare restore\n");
                compare_ignore_not_found = 0;
                compare_errors = 0;
                setup();
                printf("filesys = %s\n", filesys);
 
                Vprintf(stdout, "Begin compare restore\n");
                compare_ignore_not_found = 0;
                compare_errors = 0;
                setup();
                printf("filesys = %s\n", filesys);
-               if (stat(filesys, &stbuf) < 0)
+               if (STAT(filesys, &stbuf) < 0)
                        err(1, "cannot stat directory %s", filesys);
                if (chdir(filesys) < 0)
                        err(1, "cannot cd to %s", filesys);
                        err(1, "cannot stat directory %s", filesys);
                if (chdir(filesys) < 0)
                        err(1, "cannot cd to %s", filesys);
index e5e995d71bfe9fbe7d98521a3b8744efea60f7c2..f5a8d556b9f2299d7b34057aa2dd5ea4c55715f6 100644 (file)
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: tape.c,v 1.36 2001/04/27 12:23:23 stelian Exp $";
+       "$Id: tape.c,v 1.37 2001/04/27 15:22:47 stelian Exp $";
 #endif /* not lint */
 
 #include <config.h>
 #endif /* not lint */
 
 #include <config.h>
+#include <compatlfs.h>
 #include <errno.h>
 #include <compaterr.h>
 #include <setjmp.h>
 #include <errno.h>
 #include <compaterr.h>
 #include <setjmp.h>
@@ -251,7 +252,7 @@ void
 setup(void)
 {
        int i, j, *ip;
 setup(void)
 {
        int i, j, *ip;
-       struct stat stbuf;
+       struct STAT stbuf;
        struct mtget mt_stat;
 
        Vprintf(stdout, "Verify tape and initialize maps\n");
        struct mtget mt_stat;
 
        Vprintf(stdout, "Verify tape and initialize maps\n");
@@ -263,7 +264,7 @@ setup(void)
        if (pipein)
                mt = 0;
        else
        if (pipein)
                mt = 0;
        else
-               mt = open(magtape, O_RDONLY, 0);
+               mt = OPEN(magtape, O_RDONLY, 0);
        if (mt < 0)
                err(1, "%s", magtape);
        volno = 1;
        if (mt < 0)
                err(1, "%s", magtape);
        volno = 1;
@@ -327,7 +328,7 @@ setup(void)
        }
        dumptime = spcl.c_ddate;
        dumpdate = spcl.c_date;
        }
        dumptime = spcl.c_ddate;
        dumpdate = spcl.c_date;
-       if (stat(".", &stbuf) < 0)
+       if (STAT(".", &stbuf) < 0)
                err(1, "cannot stat .");
        if (stbuf.st_blksize > 0 && stbuf.st_blksize < TP_BSIZE )
                fssize = TP_BSIZE;
                err(1, "cannot stat .");
        if (stbuf.st_blksize > 0 && stbuf.st_blksize < TP_BSIZE )
                fssize = TP_BSIZE;
@@ -470,7 +471,7 @@ again:
                mt = rmtopen(magtape, 0);
        else
 #endif
                mt = rmtopen(magtape, 0);
        else
 #endif
-               mt = open(magtape, O_RDONLY, 0);
+               mt = OPEN(magtape, O_RDONLY, 0);
 
        if (mt == -1) {
                fprintf(stderr, "Cannot open %s\n", magtape);
 
        if (mt == -1) {
                fprintf(stderr, "Cannot open %s\n", magtape);
@@ -738,7 +739,7 @@ extractfile(char *name)
                }
                if (uflag)
                        (void)unlink(name);
                }
                if (uflag)
                        (void)unlink(name);
-               if ((ofile = open(name, O_WRONLY | O_CREAT | O_TRUNC,
+               if ((ofile = OPEN(name, O_WRONLY | O_CREAT | O_TRUNC,
                    0666)) < 0) {
                        warn("%s: cannot create file", name);
                        skipfile();
                    0666)) < 0) {
                        warn("%s: cannot create file", name);
                        skipfile();
@@ -848,11 +849,15 @@ loop:
        }
        if (size > 0) {
                fprintf(stderr, "Missing blocks at the end of %s, assuming hole\n", curfile.name);
        }
        if (size > 0) {
                fprintf(stderr, "Missing blocks at the end of %s, assuming hole\n", curfile.name);
-               (*skip)(clearedbuf, size);
+               while (size > 0) {
+                       size_t skp = size > TP_BSIZE ? TP_BSIZE : size;
+                       (*skip)(clearedbuf, skp);
+                       size -= skp;
+               }
                last_write_was_hole = 1;
        }
        if (last_write_was_hole) {
                last_write_was_hole = 1;
        }
        if (last_write_was_hole) {
-               ftruncate(ofile, origsize);
+               FTRUNCATE(ofile, origsize);
        }
        findinode(&spcl);
        gettingfile = 0;
        }
        findinode(&spcl);
        gettingfile = 0;
@@ -880,7 +885,7 @@ static void
 xtrskip(char *buf, size_t size)
 {
 
 xtrskip(char *buf, size_t size)
 {
 
-       if (lseek(ofile, (off_t)size, SEEK_CUR) == -1)
+       if (LSEEK(ofile, (off_t)size, SEEK_CUR) == -1)
                err(1, "seek error extracting inode %lu, name %s\nlseek",
                        (unsigned long)curfile.ino, curfile.name);
 }
                err(1, "seek error extracting inode %lu, name %s\nlseek",
                        (unsigned long)curfile.ino, curfile.name);
 }
@@ -1038,12 +1043,12 @@ int
 #else
 void
 #endif
 #else
 void
 #endif
-cmpfiles(char *tapefile, char *diskfile, struct stat *sbuf_disk)
+cmpfiles(char *tapefile, char *diskfile, struct STAT *sbuf_disk)
 {
 {
-       struct stat sbuf_tape;
+       struct STAT sbuf_tape;
        int fd_tape, fd_disk;
 
        int fd_tape, fd_disk;
 
-       if (stat(tapefile, &sbuf_tape) != 0) {
+       if (STAT(tapefile, &sbuf_tape) != 0) {
                panic("Can't lstat tmp file %s: %s\n", tapefile,
                      strerror(errno));
                compare_errors = 1;
                panic("Can't lstat tmp file %s: %s\n", tapefile,
                      strerror(errno));
                compare_errors = 1;
@@ -1061,11 +1066,11 @@ cmpfiles(char *tapefile, char *diskfile, struct stat *sbuf_disk)
 #endif
        }
 
 #endif
        }
 
-       if ((fd_tape = open(tapefile, O_RDONLY)) < 0) {
+       if ((fd_tape = OPEN(tapefile, O_RDONLY)) < 0) {
                panic("Can't open %s: %s\n", tapefile, strerror(errno));
                compare_errors = 1;
        }
                panic("Can't open %s: %s\n", tapefile, strerror(errno));
                compare_errors = 1;
        }
-       if ((fd_disk = open(diskfile, O_RDONLY)) < 0) {
+       if ((fd_disk = OPEN(diskfile, O_RDONLY)) < 0) {
                close(fd_tape);
                panic("Can't open %s: %s\n", diskfile, strerror(errno));
                compare_errors = 1;
                close(fd_tape);
                panic("Can't open %s: %s\n", diskfile, strerror(errno));
                compare_errors = 1;
@@ -1120,14 +1125,14 @@ void
 comparefile(char *name)
 {
        int mode;
 comparefile(char *name)
 {
        int mode;
-       struct stat sb;
+       struct STAT sb;
        int r;
 #if !COMPARE_ONTHEFLY
        static char *tmpfile = NULL;
        int r;
 #if !COMPARE_ONTHEFLY
        static char *tmpfile = NULL;
-       struct stat stemp;
+       struct STAT stemp;
 #endif
 
 #endif
 
-       if ((r = lstat(name, &sb)) != 0) {
+       if ((r = LSTAT(name, &sb)) != 0) {
                warn("%s: does not exist (%d)", name, r);
                compare_errors = 1;
                skipfile();
                warn("%s: does not exist (%d)", name, r);
                compare_errors = 1;
                skipfile();
@@ -1220,7 +1225,7 @@ comparefile(char *name)
 
        case IFREG:
 #if COMPARE_ONTHEFLY
 
        case IFREG:
 #if COMPARE_ONTHEFLY
-               if ((ifile = open(name, O_RDONLY)) < 0) {
+               if ((ifile = OPEN(name, O_RDONLY)) < 0) {
                        panic("Can't open %s: %s\n", name, strerror(errno));
                        skipfile();
                        compare_errors = 1;
                        panic("Can't open %s: %s\n", name, strerror(errno));
                        skipfile();
                        compare_errors = 1;
@@ -1246,11 +1251,11 @@ comparefile(char *name)
                        snprintf(tmpfilename, sizeof(tmpfilename), "%s/restoreCXXXXXX", tmpdir);
                        tmpfile = mktemp(&tmpfilename[0]);
                }
                        snprintf(tmpfilename, sizeof(tmpfilename), "%s/restoreCXXXXXX", tmpdir);
                        tmpfile = mktemp(&tmpfilename[0]);
                }
-               if ((stat(tmpfile, &stemp) == 0) && (unlink(tmpfile) != 0)) {
+               if ((STAT(tmpfile, &stemp) == 0) && (unlink(tmpfile) != 0)) {
                        panic("cannot delete tmp file %s: %s\n",
                              tmpfile, strerror(errno));
                }
                        panic("cannot delete tmp file %s: %s\n",
                              tmpfile, strerror(errno));
                }
-               if ((ofile = open(tmpfile, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0) {
+               if ((ofile = OPEN(tmpfile, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0) {
                        panic("cannot create file temp file %s: %s\n",
                              name, strerror(errno));
                }
                        panic("cannot create file temp file %s: %s\n",
                              name, strerror(errno));
                }
@@ -1399,7 +1404,7 @@ getmore:
                        seek_failed = (rmtseek(i, 1) < 0);
                else
 #endif
                        seek_failed = (rmtseek(i, 1) < 0);
                else
 #endif
-                       seek_failed = (lseek(mt, i, SEEK_CUR) == (off_t)-1);
+                       seek_failed = (LSEEK(mt, i, SEEK_CUR) == (off_t)-1);
 
                if (seek_failed) {
                        warn("continuation failed");
 
                if (seek_failed) {
                        warn("continuation failed");
index 64fc4ab023b2fce60c4352e57caa4e1a38f508f6..e23d0a3f350c860a6c15efe68230d2058f2c933e 100644 (file)
--- a/rmt/rmt.c
+++ b/rmt/rmt.c
 
 #ifndef lint
 static const char rcsid[] =
 
 #ifndef lint
 static const char rcsid[] =
-       "$Id: rmt.c,v 1.13 2001/03/28 12:59:49 stelian Exp $";
+       "$Id: rmt.c,v 1.14 2001/04/27 15:22:47 stelian Exp $";
 #endif /* not linux */
 
 /*
  * rmt
  */
 #include <config.h>
 #endif /* not linux */
 
 /*
  * rmt
  */
 #include <config.h>
+#include <compatlfs.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/mtio.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/mtio.h>
@@ -114,7 +115,7 @@ top:
                 * specify the permission bits; allow rw for everyone,
                 * as modified by the users umask
                 */
                 * specify the permission bits; allow rw for everyone,
                 * as modified by the users umask
                 */
-               tape = open(device, atoi(filemode), 0666);
+               tape = OPEN(device, atoi(filemode), 0666);
                if (tape < 0)
                        goto ioerror;
                block = 0;
                if (tape < 0)
                        goto ioerror;
                block = 0;
@@ -133,7 +134,7 @@ top:
                getstring(count);
                getstring(pos);
                DEBUG2("rmtd: L %s %s\n", count, pos);
                getstring(count);
                getstring(pos);
                DEBUG2("rmtd: L %s %s\n", count, pos);
-               rval = lseek(tape, (off_t)atol(count), atoi(pos));
+               rval = LSEEK(tape, (off_t)atol(count), atoi(pos));
                if (rval < 0)
                        goto ioerror;
                goto respond;
                if (rval < 0)
                        goto ioerror;
                goto respond;