summaryrefslogtreecommitdiff
path: root/mtab.c
diff options
context:
space:
mode:
authorErik Andersen2000-02-07 05:29:42 +0000
committerErik Andersen2000-02-07 05:29:42 +0000
commitfac10d7c59f7db0facd5fb94de273310b9ec86e6 (patch)
treedccf8f905fc5807239883da9fca6597037d487fc /mtab.c
parent50bc101b7d6e847a9a0621ca3eb28c7117d095e5 (diff)
downloadbusybox-fac10d7c59f7db0facd5fb94de273310b9ec86e6.zip
busybox-fac10d7c59f7db0facd5fb94de273310b9ec86e6.tar.gz
A few minor updates. ;-)
Seriously though, read the Changelog for busybox 0.42, which this is about to become... -Erik
Diffstat (limited to 'mtab.c')
-rw-r--r--mtab.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/mtab.c b/mtab.c
index 98e42a3..41d8818 100644
--- a/mtab.c
+++ b/mtab.c
@@ -5,21 +5,13 @@
#include <string.h>
#include <stdio.h>
#include <mntent.h>
+#include <fstab.h>
#include <sys/mount.h>
extern const char mtab_file[]; /* Defined in utility.c */
-static char *
-stralloc(const char * string)
-{
- int length = strlen(string) + 1;
- char * n = malloc(length);
- memcpy(n, string, length);
- return n;
-}
-extern void
-erase_mtab(const char * name)
+void erase_mtab(const char * name)
{
struct mntent entries[20];
int count = 0;
@@ -39,10 +31,10 @@ erase_mtab(const char * name)
}
while ( (m = getmntent(mountTable)) != 0 ) {
- entries[count].mnt_fsname = stralloc(m->mnt_fsname);
- entries[count].mnt_dir = stralloc(m->mnt_dir);
- entries[count].mnt_type = stralloc(m->mnt_type);
- entries[count].mnt_opts = stralloc(m->mnt_opts);
+ entries[count].mnt_fsname = strdup(m->mnt_fsname);
+ entries[count].mnt_dir = strdup(m->mnt_dir);
+ entries[count].mnt_type = strdup(m->mnt_type);
+ entries[count].mnt_opts = strdup(m->mnt_opts);
entries[count].mnt_freq = m->mnt_freq;
entries[count].mnt_passno = m->mnt_passno;
count++;
@@ -65,8 +57,7 @@ erase_mtab(const char * name)
perror(mtab_file);
}
-extern void
-write_mtab(char* blockDevice, char* directory,
+void write_mtab(char* blockDevice, char* directory,
char* filesystemType, long flags, char* string_flags)
{
FILE *mountTable = setmntent(mtab_file, "a+");
@@ -110,4 +101,3 @@ write_mtab(char* blockDevice, char* directory,
}
}
-