/* vi: set sw=4 ts=4: */
-#include "busybox.h"
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <mntent.h>
#include <fstab.h>
#include <sys/mount.h>
+#include "busybox.h"
extern const char mtab_file[]; /* Defined in utility.c */
/* Check if reading the mtab file failed */
if (mountTable == 0
-#if ! defined BB_FEATURE_USE_PROCFS
- ) {
-#else
- /* Bummer. fall back on trying the /proc filesystem */
- && (mountTable = setmntent("/proc/mounts", "r")) == 0) {
-#endif
- perror(mtab_file);
+ /* Bummer. fall back on trying the /proc filesystem */
+ && (mountTable = setmntent("/proc/mounts", "r")) == 0) {
+ perror_msg("%s", mtab_file);
return;
}
}
endmntent(mountTable);
} else if (errno != EROFS)
- perror(mtab_file);
+ perror_msg("%s", mtab_file);
}
void write_mtab(char *blockDevice, char *directory,
struct mntent m;
if (mountTable == 0) {
- perror(mtab_file);
+ perror_msg("%s", mtab_file);
return;
}
if (mountTable) {
if (length > 1 && directory[length - 1] == '/')
directory[length - 1] = '\0';
-#ifdef BB_FEATURE_USE_PROCFS
if (filesystemType == 0) {
struct mntent *p = find_mount_point(blockDevice, "/proc/mounts");
if (p && p->mnt_type)
filesystemType = p->mnt_type;
}
-#endif
m.mnt_fsname = blockDevice;
m.mnt_dir = directory;
m.mnt_type = filesystemType ? filesystemType : "default";