Major coreutils update.
This commit is contained in:
13
libbb/mtab.c
13
libbb/mtab.c
@@ -27,21 +27,20 @@
|
||||
#include <mntent.h>
|
||||
#include "libbb.h"
|
||||
|
||||
extern const char mtab_file[]; /* Defined in utility.c */
|
||||
static const int MS_RDONLY = 1; /* Mount read-only. */
|
||||
|
||||
void erase_mtab(const char *name)
|
||||
{
|
||||
struct mntent entries[20];
|
||||
int count = 0;
|
||||
FILE *mountTable = setmntent(mtab_file, "r");
|
||||
FILE *mountTable = setmntent(bb_path_mtab_file, "r");
|
||||
struct mntent *m;
|
||||
|
||||
/* Check if reading the mtab file failed */
|
||||
if (mountTable == 0
|
||||
/* Bummer. fall back on trying the /proc filesystem */
|
||||
&& (mountTable = setmntent("/proc/mounts", "r")) == 0) {
|
||||
perror_msg("%s", mtab_file);
|
||||
bb_perror_msg(bb_path_mtab_file);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -55,7 +54,7 @@ void erase_mtab(const char *name)
|
||||
count++;
|
||||
}
|
||||
endmntent(mountTable);
|
||||
if ((mountTable = setmntent(mtab_file, "w"))) {
|
||||
if ((mountTable = setmntent(bb_path_mtab_file, "w"))) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
@@ -69,17 +68,17 @@ void erase_mtab(const char *name)
|
||||
}
|
||||
endmntent(mountTable);
|
||||
} else if (errno != EROFS)
|
||||
perror_msg("%s", mtab_file);
|
||||
bb_perror_msg(bb_path_mtab_file);
|
||||
}
|
||||
|
||||
void write_mtab(char *blockDevice, char *directory,
|
||||
char *filesystemType, long flags, char *string_flags)
|
||||
{
|
||||
FILE *mountTable = setmntent(mtab_file, "a+");
|
||||
FILE *mountTable = setmntent(bb_path_mtab_file, "a+");
|
||||
struct mntent m;
|
||||
|
||||
if (mountTable == 0) {
|
||||
perror_msg("%s", mtab_file);
|
||||
bb_perror_msg(bb_path_mtab_file);
|
||||
return;
|
||||
}
|
||||
if (mountTable) {
|
||||
|
Reference in New Issue
Block a user