fstab-util.c revision 2366ab3026fc3a52dee17bba1b3a60eaa655c2eb
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2015 Zbigniew Jędrzejewski-Szmek
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "fstab-util.h"
#include "path-util.h"
#include "strv.h"
#include "util.h"
bool fstab_is_mount_point(const char *mount) {
struct mntent *m;
if (!f)
return false;
while ((m = getmntent(f)))
return true;
return false;
}
if (!opts)
goto answer;
/* If !value and !filtered, this function is not allowed to fail. */
if (!filtered) {
size_t l;
continue;
continue;
/* we know that the string is NUL
* terminated, so *x is valid */
n = name;
if (value) {
free(v);
v = NULL;
else {
assert(*x == '=');
x++;
if (!v)
return -ENOMEM;
}
}
}
}
} else {
char **t, **s;
if (!stor)
return -ENOMEM;
if (!strv)
return -ENOMEM;
for (s = t = strv; *s; s++) {
x = startswith(*s, name);
goto found;
}
*t = *s;
t++;
continue;
/* Keep the last occurence found */
n = name;
if (value) {
free(v);
if (*x == '\0')
v = NULL;
else {
assert(*x == '=');
x++;
v = strdup(x);
if (!v)
return -ENOMEM;
}
}
}
*t = NULL;
}
if (namefound)
*namefound = n;
if (filtered) {
char *f;
if (!f)
return -ENOMEM;
*filtered = f;
}
if (value) {
*value = v;
v = NULL;
}
return !!n;
}
char **s;
if (!optsv)
return -ENOMEM;
STRV_FOREACH(s, optsv) {
char *arg;
int r;
continue;
if (r < 0)
return r;
}
return !!*values;
}
int r;
unsigned pri;
if (r < 0)
return r;
if (r == 0 || !opt)
return 0;
if (r < 0)
return r;
if ((int) pri < 0)
return -ERANGE;
return 1;
}