GNU bug report logs -
#24392
[INSTALLED PATCH 2/2] sort: port to strict C + valgrind
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Thu, 8 Sep 2016 02:54:03 UTC
Severity: normal
Tags: patch
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24392 in the body.
You can then email your comments to 24392 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#24392
; Package
coreutils
.
(Thu, 08 Sep 2016 02:54:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Thu, 08 Sep 2016 02:54:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* bootstrap.conf (gnulib_modules): Add flexmember.
* src/sort.c: Include flexmember.h.
(struct tempnode): Make the last member flexible.
(create_temp_file): Port to strict C11/C99 rules for
allocation alignment with flexible array members.
---
bootstrap.conf | 1 +
src/sort.c | 5 +++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index 985018f..8a0ff31 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -88,6 +88,7 @@ gnulib_modules="
filemode
filenamecat
filevercmp
+ flexmember
fnmatch-gnu
fopen-safer
fprintftime
diff --git a/src/sort.c b/src/sort.c
index 0795475..b30f5d0 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -34,6 +34,7 @@
#include "error.h"
#include "fadvise.h"
#include "filevercmp.h"
+#include "flexmember.h"
#include "hard-locale.h"
#include "hash.h"
#include "heap.h"
@@ -667,7 +668,7 @@ struct tempnode
struct tempnode *volatile next;
pid_t pid; /* The subprocess PID; undefined if state == UNCOMPRESSED. */
char state;
- char name[1]; /* Actual size is 1 + file name length. */
+ char name[FLEXIBLE_ARRAY_MEMBER];
};
static struct tempnode *volatile temphead;
static struct tempnode *volatile *temptail = &temphead;
@@ -855,7 +856,7 @@ create_temp_file (int *pfd, bool survive_fd_exhaustion)
char const *temp_dir = temp_dirs[temp_dir_index];
size_t len = strlen (temp_dir);
struct tempnode *node =
- xmalloc (offsetof (struct tempnode, name) + len + sizeof slashbase);
+ xmalloc (FLEXSIZEOF (struct tempnode, name, len + sizeof slashbase));
char *file = node->name;
struct cs_status cs;
--
2.7.4
bug closed, send any further explanations to
24392 <at> debbugs.gnu.org and Paul Eggert <eggert <at> cs.ucla.edu>
Request was from
Paul Eggert <eggert <at> cs.ucla.edu>
to
control <at> debbugs.gnu.org
.
(Thu, 08 Sep 2016 04:46:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 06 Oct 2016 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 318 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.