X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=compat%2Flib%2Ffstab.c;h=9f11a65d7bf3ee058a018a713c4c0e57a00d4f4b;hb=43460f04f3920ae39f345a2fb39d000a890a4283;hp=0b51de5040e87bf98bdb51e3b00018fd34107ca7;hpb=b45f51d61e911ac8a040bef1efda6afd82261e03;p=dump.git diff --git a/compat/lib/fstab.c b/compat/lib/fstab.c index 0b51de5..9f11a65 100644 --- a/compat/lib/fstab.c +++ b/compat/lib/fstab.c @@ -2,8 +2,8 @@ * Ported to Linux's Second Extended File System as part of the * dump and restore backup suit * Remy Card , 1994-1997 - * Stelian Pop , 1999 - * + * Stelian Pop , 1999-2000 + * Stelian Pop - AlcĂ´ve , 2000 */ /* @@ -39,10 +39,12 @@ * SUCH DAMAGE. */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)fstab.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ +#ifndef lint +static const char rcsid[] = + "$Id: fstab.c,v 1.11 2001/03/19 13:22:48 stelian Exp $"; +#endif /* not lint */ +#include #include #include #include @@ -50,6 +52,7 @@ static char sccsid[] = "@(#)fstab.c 8.1 (Berkeley) 6/4/93"; #include #include #include +#include static FILE *_fs_fp; static struct fstab _fs_fstab; @@ -57,8 +60,10 @@ static struct fstab _fs_fstab; static void error __P((int)); static int fstabscan __P((void)); +void msg __P((const char *fmt, ...)); + static -int fstabscan() +int fstabscan(void) { struct mntent *mnt; register char *cp; @@ -67,10 +72,16 @@ int fstabscan() char subline[MAXLINELENGTH]; for (;;) { + const char *device_name; if (!(mnt = getmntent(_fs_fp))) return 0; - _fs_fstab.fs_spec = mnt->mnt_fsname; + device_name = get_device_name(mnt->mnt_fsname); + if (!device_name) { + msg("Warning: unable to translate %s\n", mnt->mnt_fsname); + continue; + } + _fs_fstab.fs_spec = device_name; _fs_fstab.fs_file = mnt->mnt_dir; _fs_fstab.fs_vfstype = mnt->mnt_type; _fs_fstab.fs_mntops = mnt->mnt_opts; @@ -111,7 +122,7 @@ int fstabscan() } struct fstab * -getfsent() +getfsent(void) { if ((!_fs_fp && !setfsent()) || !fstabscan()) return((struct fstab *)NULL); @@ -119,8 +130,7 @@ getfsent() } struct fstab * -getfsspec(name) - register const char *name; +getfsspec(const char *name) { if (setfsent()) while (fstabscan()) @@ -130,8 +140,7 @@ getfsspec(name) } struct fstab * -getfsfile(name) - register const char *name; +getfsfile(const char *name) { if (setfsent()) while (fstabscan()) @@ -140,7 +149,8 @@ getfsfile(name) return((struct fstab *)NULL); } -int setfsent() +int +setfsent(void) { if (_fs_fp) { rewind(_fs_fp); @@ -153,7 +163,7 @@ int setfsent() } void -endfsent() +endfsent(void) { if (_fs_fp) { (void)endmntent(_fs_fp); @@ -162,8 +172,7 @@ endfsent() } static -void error(err) - int err; +void error(int err) { char *p;