summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2012-10-15 14:06:53 -0700
committerGerrit <chrome-bot@google.com>2012-10-16 11:26:39 -0700
commitb59d06e6e8ef43e37dd568c2b5ae20d7b4b42433 (patch)
treef55778b970abba19bb8fd09d6b5df18ad760f0b2
parentadc676422972e28c1b38268852f6cec24a57366f (diff)
downloadvboot-b59d06e6e8ef43e37dd568c2b5ae20d7b4b42433.tar.gz
mount-encrypted: fix mount detection to use device
Instead of fsid, which is unpopulated for tmpfs, use device number since that will increment for each different tmpfs. BUG=chrome-os-partner:15192 TEST=parrot build, manual testing BRANCH=none Change-Id: I0024f7283c90684daaf1278d3cf6b76cc85bb253 Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35615 Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Elly Jones <ellyjones@chromium.org>
-rw-r--r--utility/mount-helpers.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/utility/mount-helpers.c b/utility/mount-helpers.c
index 29db21cf..aed5ef06 100644
--- a/utility/mount-helpers.c
+++ b/utility/mount-helpers.c
@@ -19,7 +19,6 @@
#include <math.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
-#include <sys/statvfs.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/mount.h>
@@ -99,17 +98,17 @@ int runcmd(const gchar *argv[], gchar **output)
int same_vfs(const char *mnt_a, const char *mnt_b)
{
- struct statvfs stat_a, stat_b;
+ struct stat stat_a, stat_b;
- if (statvfs(mnt_a, &stat_a)) {
- PERROR("statvfs(%s)", mnt_a);
+ if (lstat(mnt_a, &stat_a)) {
+ PERROR("lstat(%s)", mnt_a);
exit(1);
}
- if (statvfs(mnt_b, &stat_b)) {
- PERROR("statvfs(%s)", mnt_b);
+ if (lstat(mnt_b, &stat_b)) {
+ PERROR("lstat(%s)", mnt_b);
exit(1);
}
- return (stat_a.f_fsid == stat_b.f_fsid);
+ return (stat_a.st_dev == stat_b.st_dev);
}
/* Returns allocated string that holds [length]*2 + 1 characters. */