[v6,4/5] xfsprogs: reset opterr on platform_getoptreset()
diff mbox

Message ID 20180612003039.17154-5-mcgrof@kernel.org
State New
Headers show

Commit Message

Luis Chamberlain June 12, 2018, 12:30 a.m. UTC
Setting opterr = 0 is useful if you want to only parse a subset of
paremeters first. Later you will have to set opterr = 1 again, but
we already have a platform_getoptreset() and its expected to be used
in these contexts so just sprinkle it there.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
---
 include/darwin.h      | 1 +
 include/gnukfreebsd.h | 1 +
 include/linux.h       | 1 +
 3 files changed, 3 insertions(+)

Patch
diff mbox

diff --git a/include/darwin.h b/include/darwin.h
index 2632e1d6f08c..4c23a1a3f739 100644
--- a/include/darwin.h
+++ b/include/darwin.h
@@ -79,6 +79,7 @@  static __inline__ void platform_getoptreset(void)
 {
 	extern int optreset;
 	optreset = 0;
+	opterr = 1;
 }
 
 static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2)
diff --git a/include/gnukfreebsd.h b/include/gnukfreebsd.h
index 1db3f4f010e3..26e5d9e08cd5 100644
--- a/include/gnukfreebsd.h
+++ b/include/gnukfreebsd.h
@@ -83,6 +83,7 @@  static __inline__ void platform_getoptreset(void)
 {
 	extern int optind;
 	optind = 0;
+	opterr = 1;
 }
 
 static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2)
diff --git a/include/linux.h b/include/linux.h
index 1998941a6df5..a9273239c419 100644
--- a/include/linux.h
+++ b/include/linux.h
@@ -88,6 +88,7 @@  static __inline__ void platform_getoptreset(void)
 {
 	extern int optind;
 	optind = 0;
+	opterr = 1;
 }
 
 static __inline__ int platform_uuid_compare(uuid_t *uu1, uuid_t *uu2)