- fix btrfsctl to return 0 on success and 1 on failure

This commit is contained in:
Josef Bacik 2010-02-02 14:55:23 +00:00
parent abc69ecb47
commit cae92fdd04
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From 8b6be4c65eda396e0c42182f4ebf2794c62b442c Mon Sep 17 00:00:00 2001
From: Josef Bacik <josef@redhat.com>
Date: Tue, 2 Feb 2010 09:51:15 -0500
Subject: [PATCH] Btrfs-progs: make btrfsctl return values like everybody else
This patch makes btrfsctl return 0 for success and 1 for failure, which is the
behavior of all other userspace applications. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
---
btrfsctl.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/btrfsctl.c b/btrfsctl.c
index 66c4e89..73d9c30 100644
--- a/btrfsctl.c
+++ b/btrfsctl.c
@@ -231,9 +231,7 @@ int main(int ac, char **av)
printf("ioctl failed with error %d\n", ret);
}
printf("%s\n", BTRFS_BUILD_VERSION);
- if (ret)
- exit(0);
- else
- exit(1);
+
+ return ret ? 1 : 0;
}
--
1.6.6

View File

@ -1,6 +1,6 @@
Name: btrfs-progs
Version: 0.19
Release: 7%{?dist}
Release: 8%{?dist}
Summary: Userspace programs for btrfs
Group: System Environment/Base
@ -10,6 +10,7 @@ Source0: http://www.kernel.org/pub/linux/kernel/people/mason/btrfs/%{name
Patch0: btrfs-progs-fix-labels.patch
Patch1: btrfs-progs-build-everything.patch
Patch2: btrfs-progs-valgrind.patch
Patch3: btrfs-progs-fix-return-value.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: e2fsprogs-devel, libuuid-devel, zlib-devel, libacl-devel
@ -25,6 +26,7 @@ check, modify and correct any inconsistencies in the btrfs filesystem.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
@ -56,6 +58,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man8/mkfs.btrfs.8.gz
%changelog
* Tue Feb 2 2010 Josef Bacik <josef@toxicpanda.com> 0.19-8
- fix btrfsctl to return 0 on success and 1 on failure
* Tue Aug 25 2009 Josef Bacik <josef@toxicpanda.com> 0.19-7
- add btrfs-progs-valgrind.patch to fix memory leaks and segfaults