]> git.pld-linux.org Git - packages/pinfo.git/blame - pinfo-truncation-workaround.patch
- added truncation-workaround patch to workaround build failure on th-i686; release 2
[packages/pinfo.git] / pinfo-truncation-workaround.patch
CommitLineData
9f8b3f1f
JB
1gcc's -Werror=stringop-truncation tries to be too smart, but actually it isn't.
2Take len just after initialization, before call to mkstemp() (which doesn't change string length);
3now gcc doesn't complain.
4
5--- pinfo-0.6.13/src/utils.c.orig 2019-02-16 21:23:32.000000000 +0100
6+++ pinfo-0.6.13/src/utils.c 2021-10-03 07:45:00.428038370 +0200
7@@ -848,10 +848,10 @@ char *
8 make_tempfile()
9 {
10 char *filename;
11- size_t len;
12
13 /* TODO: fix hardcoded /tmp */
14 char tmpfile_template[] = "/tmp/pinfo.XXXXXX";
15+ size_t len = strlen(tmpfile_template)+1;
16
17 /* create a tmpfile */
18 int fd = mkstemp(tmpfile_template);
19@@ -864,7 +864,6 @@ make_tempfile()
20 }
21
22 /* allocate a new string and copy the filename there */
23- len = strlen(tmpfile_template)+1;
24 filename = xmalloc(len+1); /* guarenteerd to be set to \0's */
25 strncpy(filename, tmpfile_template, len);
26
This page took 0.062176 seconds and 4 git commands to generate.