Accepting request 75017 from filesystems
- fix failing on deleted loop mounts (bnc#697671) OBS-URL: https://build.opensuse.org/request/show/75017 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/btrfsprogs?expand=0&rev=20
This commit is contained in:
parent
f1d9bdca52
commit
b7e7c9fe1c
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jul 1 16:31:44 CEST 2011 - dmueller@suse.de
|
||||||
|
|
||||||
|
- fix failing on deleted loop mounts (bnc#697671)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Mar 21 13:01:23 CET 2011 - dmueller@suse.de
|
Mon Mar 21 13:01:23 CET 2011 - dmueller@suse.de
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ Supplements: filesystem(btrfs)
|
|||||||
Source: btrfs-progs-%{tar_version}.tar.bz2
|
Source: btrfs-progs-%{tar_version}.tar.bz2
|
||||||
Patch0: memleak-fix.diff
|
Patch0: memleak-fix.diff
|
||||||
Patch1: 0001-Plug-Memory-leak-in-find_and_setup_log_root.patch
|
Patch1: 0001-Plug-Memory-leak-in-find_and_setup_log_root.patch
|
||||||
|
Patch2: ignore-deleted-loopmounts.diff
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
BuildRequires: libacl-devel libext2fs-devel libuuid-devel zlib-devel
|
BuildRequires: libacl-devel libext2fs-devel libuuid-devel zlib-devel
|
||||||
# for /bin/true
|
# for /bin/true
|
||||||
@ -42,6 +43,7 @@ debugging btrfs file systems.
|
|||||||
%setup -q -n btrfs-progs-%{tar_version}
|
%setup -q -n btrfs-progs-%{tar_version}
|
||||||
%patch0
|
%patch0
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
make %{?jobs:-j%jobs} CFLAGS="%{optflags}" all convert
|
make %{?jobs:-j%jobs} CFLAGS="%{optflags}" all convert
|
||||||
|
81
ignore-deleted-loopmounts.diff
Normal file
81
ignore-deleted-loopmounts.diff
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
diff --git a/utils.c b/utils.c
|
||||||
|
index fd894f3..4f089f5 100644
|
||||||
|
--- a/utils.c
|
||||||
|
+++ b/utils.c
|
||||||
|
@@ -633,19 +633,29 @@ int is_same_blk_file(const char* a, const char* b)
|
||||||
|
char real_a[PATH_MAX];
|
||||||
|
char real_b[PATH_MAX];
|
||||||
|
|
||||||
|
- if(!realpath(a, real_a) ||
|
||||||
|
- !realpath(b, real_b))
|
||||||
|
- {
|
||||||
|
- return -errno;
|
||||||
|
- }
|
||||||
|
+ if(!realpath(a, real_a))
|
||||||
|
+ strcpy(real_a, a);
|
||||||
|
+
|
||||||
|
+ if (!realpath(b, real_b))
|
||||||
|
+ strcpy(real_b, b);
|
||||||
|
|
||||||
|
/* Identical path? */
|
||||||
|
if(strcmp(real_a, real_b) == 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
- if(stat(a, &st_buf_a) < 0 ||
|
||||||
|
- stat(b, &st_buf_b) < 0)
|
||||||
|
- {
|
||||||
|
+ if(stat(a, &st_buf_a) < 0)
|
||||||
|
+ {
|
||||||
|
+ if (errno == ENOENT)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ return -errno;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if(stat(b, &st_buf_b) < 0)
|
||||||
|
+ {
|
||||||
|
+ if (errno == ENOENT)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -684,10 +694,12 @@ int is_same_loop_file(const char* a, const char* b)
|
||||||
|
if((ret = is_loop_device(a)) < 0) {
|
||||||
|
return ret;
|
||||||
|
} else if(ret) {
|
||||||
|
- if((ret = resolve_loop_device(a, res_a, sizeof(res_a))) < 0)
|
||||||
|
+ if((ret = resolve_loop_device(a, res_a, sizeof(res_a))) < 0) {
|
||||||
|
+ if (errno != EPERM)
|
||||||
|
return ret;
|
||||||
|
-
|
||||||
|
- final_a = res_a;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ final_a = res_a;
|
||||||
|
} else {
|
||||||
|
final_a = a;
|
||||||
|
}
|
||||||
|
@@ -696,15 +708,17 @@ int is_same_loop_file(const char* a, const char* b)
|
||||||
|
if((ret = is_loop_device(b)) < 0) {
|
||||||
|
return ret;
|
||||||
|
} else if(ret) {
|
||||||
|
- if((ret = resolve_loop_device(b, res_b, sizeof(res_b))) < 0)
|
||||||
|
- return ret;
|
||||||
|
-
|
||||||
|
- final_b = res_b;
|
||||||
|
+ if((ret = resolve_loop_device(b, res_b, sizeof(res_b))) < 0) {
|
||||||
|
+ if (errno != EPERM)
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ final_b = res_b;
|
||||||
|
} else {
|
||||||
|
final_b = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
- return is_same_blk_file(final_a, final_b);
|
||||||
|
+ return is_same_blk_file(final_a, final_b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Checks if a file exists and is a block or regular file*/
|
Loading…
Reference in New Issue
Block a user