Fix fstabinfo for mounting /dev/shm, Gentoo #245367.
This commit is contained in:
parent
282ad4bae6
commit
7467440a29
@ -75,7 +75,8 @@
|
|||||||
#include "rc-misc.h"
|
#include "rc-misc.h"
|
||||||
|
|
||||||
#ifdef HAVE_GETMNTENT
|
#ifdef HAVE_GETMNTENT
|
||||||
static struct mntent *getmntfile(const char *file)
|
static struct mntent *
|
||||||
|
getmntfile(const char *file)
|
||||||
{
|
{
|
||||||
struct mntent *ent;
|
struct mntent *ent;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@ -107,21 +108,21 @@ static int do_mount(struct ENT *ent)
|
|||||||
argv[6] = ENT_FILE(*ent);
|
argv[6] = ENT_FILE(*ent);
|
||||||
argv[7] = NULL;
|
argv[7] = NULL;
|
||||||
switch (pid = vfork()) {
|
switch (pid = vfork()) {
|
||||||
case -1:
|
case -1:
|
||||||
eerrorx("%s: vfork: %s", applet, strerror(errno));
|
eerrorx("%s: vfork: %s", applet, strerror(errno));
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
case 0:
|
case 0:
|
||||||
execvp(argv[0], argv);
|
execvp(argv[0], argv);
|
||||||
eerror("%s: execv: %s", applet, strerror(errno));
|
eerror("%s: execv: %s", applet, strerror(errno));
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
default:
|
default:
|
||||||
waitpid(pid, &status, 0);
|
waitpid(pid, &status, 0);
|
||||||
if (WIFEXITED(status))
|
if (WIFEXITED(status))
|
||||||
return WEXITSTATUS(status);
|
return WEXITSTATUS(status);
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +155,8 @@ static const char * const longopts_help[] = {
|
|||||||
#define OUTPUT_BLOCKDEV (1 << 5)
|
#define OUTPUT_BLOCKDEV (1 << 5)
|
||||||
#define OUTPUT_MOUNT (1 << 6)
|
#define OUTPUT_MOUNT (1 << 6)
|
||||||
|
|
||||||
int fstabinfo(int argc, char **argv)
|
int
|
||||||
|
fstabinfo(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct ENT *ent;
|
struct ENT *ent;
|
||||||
int result = EXIT_SUCCESS;
|
int result = EXIT_SUCCESS;
|
||||||
@ -238,7 +240,7 @@ int fstabinfo(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (optind < argc) {
|
if (optind < argc) {
|
||||||
if (files) {
|
if (TAILQ_FIRST(files)) {
|
||||||
TAILQ_FOREACH_SAFE(file, files, entries, file_np) {
|
TAILQ_FOREACH_SAFE(file, files, entries, file_np) {
|
||||||
for (i = optind; i < argc; i++)
|
for (i = optind; i < argc; i++)
|
||||||
if (strcmp(argv[i], file->value) == 0)
|
if (strcmp(argv[i], file->value) == 0)
|
||||||
@ -250,17 +252,17 @@ int fstabinfo(int argc, char **argv)
|
|||||||
while (optind < argc)
|
while (optind < argc)
|
||||||
rc_stringlist_add(files, argv[optind++]);
|
rc_stringlist_add(files, argv[optind++]);
|
||||||
}
|
}
|
||||||
} else if (! filtered) {
|
} else if (!filtered) {
|
||||||
START_ENT;
|
START_ENT;
|
||||||
while ((ent = GET_ENT))
|
while ((ent = GET_ENT))
|
||||||
rc_stringlist_add(files, ENT_FILE(ent));
|
rc_stringlist_add(files, ENT_FILE(ent));
|
||||||
END_ENT;
|
END_ENT;
|
||||||
|
|
||||||
if (! TAILQ_FIRST(files))
|
if (!TAILQ_FIRST(files))
|
||||||
eerrorx("%s: emtpy fstab", argv[0]);
|
eerrorx("%s: emtpy fstab", argv[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!files || !TAILQ_FIRST(files)) {
|
if (!TAILQ_FIRST(files)) {
|
||||||
rc_stringlist_free(files);
|
rc_stringlist_free(files);
|
||||||
return (EXIT_FAILURE);
|
return (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@ -268,7 +270,7 @@ int fstabinfo(int argc, char **argv)
|
|||||||
/* Ensure we always display something */
|
/* Ensure we always display something */
|
||||||
START_ENT;
|
START_ENT;
|
||||||
TAILQ_FOREACH(file, files, entries) {
|
TAILQ_FOREACH(file, files, entries) {
|
||||||
if (! (ent = GET_ENT_FILE(file->value))) {
|
if (!(ent = GET_ENT_FILE(file->value))) {
|
||||||
result = EXIT_FAILURE;
|
result = EXIT_FAILURE;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user