Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 477758 | Differences between
and this patch

Collapse All | Expand All

(-)xfsprogs-4.3.0.orig/libxfs/linux.c (-4 / +31 lines)
Lines 20-26 Link Here
20
#include <mntent.h>
20
#include <mntent.h>
21
#include <sys/stat.h>
21
#include <sys/stat.h>
22
#undef ustat
22
#undef ustat
23
#include <sys/ustat.h>
23
#include <sys/statvfs.h>
24
#include <sys/mount.h>
24
#include <sys/mount.h>
25
#include <sys/ioctl.h>
25
#include <sys/ioctl.h>
26
#include <sys/sysinfo.h>
26
#include <sys/sysinfo.h>
Lines 51-59 static int max_block_alignment; Link Here
51
int
51
int
52
platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
52
platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
53
{
53
{
54
	/* Pad ust; pre-2.6.28 linux copies out too much in 32bit compat mode */
54
	struct statfs	ust;
55
	struct ustat	ust[2];
56
	struct stat64	st;
55
	struct stat64	st;
56
	char		mounts[MAXPATHLEN];
57
	FILE*		mtab;
58
	struct mntent*	mnt;
57
59
58
	if (!s) {
60
	if (!s) {
59
		if (stat64(block, &st) < 0)
61
		if (stat64(block, &st) < 0)
Lines 63-69 platform_check_ismounted(char *name, cha Link Here
63
		s = &st;
65
		s = &st;
64
	}
66
	}
65
67
66
	if (ustat(s->st_rdev, ust) >= 0) {
68
	if (strcmp(name, block) == 0) {
69
		/* Device node was passed as parameter. Find its mount point */
70
		strcpy(mounts, (!access(PROC_MOUNTED, R_OK)) ? PROC_MOUNTED : MOUNTED);
71
		mtab = setmntent(mounts, "r");
72
		if (mtab == NULL) {
73
			if (verbose) {
74
				fprintf(stderr, _("%s: %s contains a possibly mounted filesystem\n"), progname, name);
75
			}
76
			return 1;
77
		}
78
		else {
79
			mnt = getmntent(mtab);
80
			while (mnt != NULL) {
81
				if (strcmp(block, mnt->mnt_fsname) == 0) {
82
					if (verbose) {
83
						 fprintf(stderr, _("%s: %s contains a mounted filesystem\n"), progname, name);
84
					}
85
					endmntent(mtab);
86
					return 1;
87
				}
88
				mnt = getmntent(mtab);
89
			}
90
			endmntent(mtab);
91
		}
92
	}
93
	else if (statfs(name, &ust) >= 0) {
67
		if (verbose)
94
		if (verbose)
68
			fprintf(stderr,
95
			fprintf(stderr,
69
				_("%s: %s contains a mounted filesystem\n"),
96
				_("%s: %s contains a mounted filesystem\n"),

Return to bug 477758