Skip to content

Commit cc6937f

Browse files
authored
Fix minor compiler complaints. (#211)
- Use some libc return values (seen when building with -D_FORTIFY_SOURCE=2) - function defined as func() => func(void)
1 parent 5b006be commit cc6937f

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

access.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ static Boolean ingroupset(gidset_t gid) {
2929
static gidset_t *gidset;
3030
static Boolean initialized = FALSE;
3131
if (!initialized) {
32-
initialized = TRUE;
33-
ngroups = getgroups(0, gidset);
32+
ngroups = getgroups(0, NULL);
33+
if (ngroups == -1)
34+
fail("$&access", "getgroups: %s", esstrerror(errno));
3435
gidset = ealloc(ngroups * sizeof(gidset_t));
35-
getgroups(ngroups, gidset);
36+
assert(getgroups(ngroups, gidset) != -1);
37+
initialized = TRUE;
3638
}
3739
for (i = 0; i < ngroups; i++)
3840
if (gid == gidset[i])

history.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static char history_comment_char = '#';
3939
*/
4040

4141

42-
extern void newhistbuffer() {
42+
extern void newhistbuffer(void) {
4343
assert(histbuffer == NULL);
4444
histbuffer = openbuffer(BUFSIZE);
4545
}
@@ -50,7 +50,7 @@ extern void addhistbuffer(char c) {
5050
histbuffer = bufputc(histbuffer, c);
5151
}
5252

53-
extern char *dumphistbuffer() {
53+
extern char *dumphistbuffer(void) {
5454
char *s;
5555
size_t len;
5656
assert(histbuffer != NULL);

prim-io.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ PRIM(here) {
180180
Ref(List *, cmd, tail);
181181
#ifdef PIPE_BUF
182182
if (doclen <= PIPE_BUF) {
183-
pipe(p);
183+
if (pipe(p) == -1)
184+
fail("$&here", "pipe: %s", esstrerror(errno));
184185
ewrite(p[1], doc, doclen);
185186
} else
186187
#endif

0 commit comments

Comments
 (0)