diff mbox

[2/4] Removed ISO C does not support the '%m' gnu_printf format errors

Message ID 20180604145051.146390-3-steved@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve Dickson June 4, 2018, 2:50 p.m. UTC
nfsstat.c: In function 'mounts':
nfsstat.c:1016:3: error: ISO C does not support the '%m' gnu_printf
format [-Werror=format=]
   fprintf(stderr, "Warning: %s: %m\n", name);
   ^
nfsstat.c: In function 'get_stats':
nfsstat.c:1093:6: error: ISO C does not support the '%m' gnu_printf
format [-Werror=format=]
      label, file);

statd.c: In function 'set_nlm_port':
statd.c:235:5: error: ISO C does not support the '%m' gnu_printf format
[-Werror=format=]
     name_p, type);
     ^
statd.c:238:3: error: ISO C does not support the '%m' gnu_printf format
[-Werror=format=]
   fprintf(stderr, "%s: failed to open %s: %m\n", name_p, pathbuf);

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/nfsstat/nfsstat.c | 6 +++---
 utils/statd/statd.c     | 7 ++++---
 2 files changed, 7 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/utils/nfsstat/nfsstat.c b/utils/nfsstat/nfsstat.c
index c779053..8fccea7 100644
--- a/utils/nfsstat/nfsstat.c
+++ b/utils/nfsstat/nfsstat.c
@@ -1013,7 +1013,7 @@  mounts(const char *name)
 	 * be a fatal error -- it usually means the module isn't loaded.
 	 */
 	if ((fp = fopen(name, "r")) == NULL) {
-		fprintf(stderr, "Warning: %s: %m\n", name);
+		fprintf(stderr, "Warning: %s: %s\n", name, strerror(errno));
 		return 0;
 	}
 
@@ -1089,8 +1089,8 @@  out:
 		fclose(fp);
 	if (err) {
 		if (!other_opt) {
-			fprintf(stderr, "Error: No %s Stats (%s: %m). \n",
-					label, file);
+			fprintf(stderr, "Error: No %s Stats (%s: %s). \n",
+					label, file, strerror(errno));
 			exit(2);
 		}
 		*opt = 0;
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
index 563a272..2cc6cf3 100644
--- a/utils/statd/statd.c
+++ b/utils/statd/statd.c
@@ -231,11 +231,12 @@  static void set_nlm_port(char *type, int port)
 	}
 	if (fd >= 0) {
 		if (write(fd, nbuf, strlen(nbuf)) != (ssize_t)strlen(nbuf))
-			fprintf(stderr, "%s: fail to set NLM %s port: %m\n",
-				name_p, type);
+			fprintf(stderr, "%s: fail to set NLM %s port: %s\n",
+				name_p, type, strerror(errno));
 		close(fd);
 	} else
-		fprintf(stderr, "%s: failed to open %s: %m\n", name_p, pathbuf);
+		fprintf(stderr, "%s: failed to open %s: %s\n", 
+			name_p, pathbuf, strerror(errno));
 }
 
 /*