#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <unistd.h>
#include <libmount.h>
#include <blkid.h>
#include <sys/utsname.h>
static int verify_target(struct verify_context *vfy)
{
const char *tgt = mnt_fs_get_target(vfy->fs);
- const char *cn = tgt;
struct stat sb;
if (!tgt)
return verify_err(vfy, _("undefined target (fs_file)"));
if (!(flags & FL_NOCACHE)) {
- cn = mnt_resolve_target(tgt, cache);
+ const char *cn = mnt_resolve_target(tgt, cache);
if (!cn)
return -ENOMEM;
if (strcmp(cn, tgt) != 0)
const char *src = mnt_fs_get_srcpath(vfy->fs);
char *t = NULL, *v = NULL;
struct stat sb;
- int isbind;
+ int isbind, rc = 0;
/* source is NAME=value tag */
if (!src) {
/* blkid is able to parse it, but libmount does not see it as a tag --
* it means unsupported tag */
- } else if (blkid_parse_tag_string(src, &t, &v) == 0 && stat(src, &sb) != 0)
- return verify_err(vfy, _("unsupported source tag: %s"), src);
-
+ } else if (blkid_parse_tag_string(src, &t, &v) == 0 && stat(src, &sb) != 0) {
+ rc = verify_err(vfy, _("unsupported source tag: %s"), src);
+ goto done;
+ }
isbind = mnt_fs_get_option(vfy->fs, "bind", NULL, NULL) == 0;
/* source is path */
done:
free(t);
free(v);
- return 0;
+ return rc;
}
static int verify_options(struct verify_context *vfy)
rc = add_filesystem(vfy, cp);
if (rc)
- return rc;
+ break;
}
fclose(f);
- return 0;
+ return rc;
}
static int read_kernel_filesystems(struct verify_context *vfy)
{
+ int rc = 0;
#ifdef __linux__
struct utsname uts;
FILE *f;
while (!feof(f)) {
char *p, *name;
- int rc;
if (!fgets(buf, sizeof(buf), f))
break;
rc = add_filesystem(vfy, name);
if (rc)
- return rc;
+ break;
}
fclose(f);
#endif /* __linux__ */
- return 0;
+ return rc;
}
static int verify_fstype(struct verify_context *vfy)
isswap = 1;
if (!isswap && !isauto && !none && !is_supported_filesystem(vfy, type))
- verify_warn(vfy, _("%s seems unspported by the current kernel"), type);
+ verify_warn(vfy, _("%s seems unsupported by the current kernel"), type);
}
realtype = mnt_get_fstype(src, &ambi, cache);
return verify_err(vfy, _("%s does not match with on-disk %s"), type, realtype);
if (!isswap && !is_supported_filesystem(vfy, realtype))
- return verify_err(vfy, _("on-disk %s seems unspported by the current kernel"), realtype);
+ return verify_err(vfy, _("on-disk %s seems unsupported by the current kernel"), realtype);
verify_ok(vfy, _("FS type is %s"), realtype);
}
int verify_table(struct libmnt_table *tb)
{
struct verify_context vfy = { .nerrors = 0 };
- struct libmnt_iter *itr = NULL;
+ struct libmnt_iter *itr;
int rc = 0; /* overall return code (alloc errors, etc.) */
int check_order = is_listall_mode();
static int has_read_fs = 0;