File: 11-gcc-Wformat.patch

package info (click to toggle)
super 3.30.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,860 kB
  • sloc: ansic: 24,673; sh: 297; makefile: 296
file content (33 lines) | stat: -rw-r--r-- 909 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From: Robert Luberda <robert@debian.org>
Date: Mon, 21 Feb 2011 22:05:00 +0100
Subject: 11 gcc Wformat.

Fix warnings given by gcc when hardening options are enabled.
---
 getpass.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/getpass.c b/getpass.c
index c10382a..e2b091e 100644
--- a/getpass.c
+++ b/getpass.c
@@ -166,7 +166,8 @@ int n_buf;		/* size of buf.  Up to n_buf characters are written
     }
 
     if (prompt) {
-	write(fdout, prompt, strlen(prompt));
+	if (write(fdout, prompt, strlen(prompt)) != strlen(prompt))
+	    return Error(0, 0, "write(prompt) failed\n");
     }
 
     /*
@@ -177,7 +178,8 @@ int n_buf;		/* size of buf.  Up to n_buf characters are written
 	buf[(nread < n_buf) ? nread : (n_buf-1)] = '\0';
     }
     if (prompt) {
-	write(fdout, "\n", 1);
+	if (write(fdout, "\n", 1) != 1)
+	    return Error(0, 0, "write(\\n) failed\n");
     }
 
     /*