diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-11-10 11:08:35 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2017-11-10 11:08:35 +0200 |
commit | 2f1214a79a6befb629466c3e81a993123733a2fe (patch) | |
tree | acf5e1cc9289cf4b655aa873d0b01642090b1391 | |
parent | 3457c19206858d3e8155dcfc776df8818d05824b (diff) | |
download | smap-2f1214a79a6befb629466c3e81a993123733a2fe.tar.gz smap-2f1214a79a6befb629466c3e81a993123733a2fe.tar.bz2 |
Placate cc warnings
-rw-r--r-- | lib/parseopt.c | 5 | ||||
-rw-r--r-- | lib/sockmapstr.c | 2 | ||||
-rw-r--r-- | lib/stream.c | 4 | ||||
-rw-r--r-- | modules/ldap/ldap.c | 23 | ||||
-rw-r--r-- | src/smapc.c | 2 | ||||
-rw-r--r-- | src/userprivs.c | 2 |
6 files changed, 15 insertions, 23 deletions
diff --git a/lib/parseopt.c b/lib/parseopt.c index cc0c9a6..cf5319d 100644 --- a/lib/parseopt.c +++ b/lib/parseopt.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* This file is part of Smap. | 1 | /* This file is part of Smap. |
2 | Copyright (C) 2008, 2010, 2014 Sergey Poznyakoff | 2 | Copyright (C) 2008, 2010, 2014, 2017 Sergey Poznyakoff |
3 | 3 | ||
4 | Smap is free software; you can redistribute it and/or modify | 4 | Smap is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
@@ -20,6 +20,7 @@ | |||
20 | #include <smap/parseopt.h> | 20 | #include <smap/parseopt.h> |
21 | #include <smap/diag.h> | 21 | #include <smap/diag.h> |
22 | #include <string.h> | 22 | #include <string.h> |
23 | #include <ctype.h> | ||
23 | 24 | ||
24 | static struct smap_option const * | 25 | static struct smap_option const * |
25 | find_opt(struct smap_option const *opt, const char *str, const char **value, | 26 | find_opt(struct smap_option const *opt, const char *str, const char **value, |
@@ -175,8 +176,6 @@ smap_parseopt(struct smap_option const *opt, int argc, char **argv, int flags, | |||
175 | int *pindex) | 176 | int *pindex) |
176 | { | 177 | { |
177 | int i; | 178 | int i; |
178 | long n; | ||
179 | char *s; | ||
180 | int rc = 0; | 179 | int rc = 0; |
181 | const char *modname = argv[0]; | 180 | const char *modname = argv[0]; |
182 | 181 | ||
diff --git a/lib/sockmapstr.c b/lib/sockmapstr.c index 1c0d749..7e188f2 100644 --- a/lib/sockmapstr.c +++ b/lib/sockmapstr.c | |||
@@ -227,7 +227,7 @@ read_payload_length(struct sockmap_input_stream *sp) | |||
227 | if (n == 0) | 227 | if (n == 0) |
228 | return EOF; | 228 | return EOF; |
229 | len += n; | 229 | len += n; |
230 | if (p = memchr(sp->nbuf, ':', len)) { | 230 | if ((p = memchr(sp->nbuf, ':', len))) { |
231 | sp->cp = p - sp->nbuf; | 231 | sp->cp = p - sp->nbuf; |
232 | sp->nbuf[len] = 0; | 232 | sp->nbuf[len] = 0; |
233 | sp->nlen = len; | 233 | sp->nlen = len; |
diff --git a/lib/stream.c b/lib/stream.c index d039c08..c217ca6 100644 --- a/lib/stream.c +++ b/lib/stream.c | |||
@@ -225,12 +225,12 @@ _stream_flush_buffer(struct _smap_stream *stream, int all) | |||
225 | } | 225 | } |
226 | if (stream->level) { | 226 | if (stream->level) { |
227 | if (all) { | 227 | if (all) { |
228 | if (rc = _force_flush_buffer(stream)) | 228 | if ((rc = _force_flush_buffer(stream))) |
229 | return rc; | 229 | return rc; |
230 | } else if (BUFFER_FULL_P(stream)) { | 230 | } else if (BUFFER_FULL_P(stream)) { |
231 | if (stream->flags & SMAP_STREAM_EXPBUF) | 231 | if (stream->flags & SMAP_STREAM_EXPBUF) |
232 | return _stream_realloc_buffer(stream, 0); | 232 | return _stream_realloc_buffer(stream, 0); |
233 | if (rc = _force_flush_buffer(stream)) | 233 | if ((rc = _force_flush_buffer(stream))) |
234 | return rc; | 234 | return rc; |
235 | } | 235 | } |
236 | } | 236 | } |
diff --git a/modules/ldap/ldap.c b/modules/ldap/ldap.c index d686f6b..b34c560 100644 --- a/modules/ldap/ldap.c +++ b/modules/ldap/ldap.c | |||
@@ -108,7 +108,7 @@ argz_copy(char ***dst, char **a) | |||
108 | for (n = 0; a[n]; n++) | 108 | for (n = 0; a[n]; n++) |
109 | ; | 109 | ; |
110 | 110 | ||
111 | b = calloc(i + 1, sizeof(b[0])); | 111 | b = calloc(n + 1, sizeof(b[0])); |
112 | if (!b) | 112 | if (!b) |
113 | return -1; | 113 | return -1; |
114 | for (i = 0; i < n; i++) { | 114 | for (i = 0; i < n; i++) { |
@@ -200,7 +200,7 @@ parse_ldap_conf(const char *name, struct smap_option const *opt) | |||
200 | } | 200 | } |
201 | 201 | ||
202 | line = 0; | 202 | line = 0; |
203 | while (p = fgets(buf, sizeof(buf), fp)) { | 203 | while ((p = fgets(buf, sizeof(buf), fp))) { |
204 | size_t len; | 204 | size_t len; |
205 | char *errmsg; | 205 | char *errmsg; |
206 | 206 | ||
@@ -254,6 +254,7 @@ parse_ldap_conf(const char *name, struct smap_option const *opt) | |||
254 | return rc; | 254 | return rc; |
255 | } | 255 | } |
256 | 256 | ||
257 | #if 0 | ||
257 | static int | 258 | static int |
258 | readconf(struct smap_option const *opt, const char *val, char **errmsg) | 259 | readconf(struct smap_option const *opt, const char *val, char **errmsg) |
259 | { | 260 | { |
@@ -262,6 +263,7 @@ readconf(struct smap_option const *opt, const char *val, char **errmsg) | |||
262 | *errmsg = "parse error"; | 263 | *errmsg = "parse error"; |
263 | return rc; | 264 | return rc; |
264 | } | 265 | } |
266 | #endif | ||
265 | 267 | ||
266 | #define MKOPT_DEFAULT 0 | 268 | #define MKOPT_DEFAULT 0 |
267 | #define MKOPT_REUSE 0x01 | 269 | #define MKOPT_REUSE 0x01 |
@@ -502,8 +504,6 @@ ldap_connect(struct ldap_conf *conf) | |||
502 | int rc; | 504 | int rc; |
503 | char *ldapuri = NULL; | 505 | char *ldapuri = NULL; |
504 | LDAP *ld = NULL; | 506 | LDAP *ld = NULL; |
505 | char *val; | ||
506 | unsigned long lval; | ||
507 | 507 | ||
508 | if (ldap_debug_level) { | 508 | if (ldap_debug_level) { |
509 | if (ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, | 509 | if (ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, |
@@ -605,22 +605,20 @@ full_read(int fd, char *file, char *buf, size_t size) | |||
605 | static int | 605 | static int |
606 | get_passwd(struct ldap_conf *conf, struct berval *pwd, char **palloc) | 606 | get_passwd(struct ldap_conf *conf, struct berval *pwd, char **palloc) |
607 | { | 607 | { |
608 | char *file; | ||
609 | |||
610 | if (conf->bindpwfile) { | 608 | if (conf->bindpwfile) { |
611 | struct stat st; | 609 | struct stat st; |
612 | int fd, rc; | 610 | int fd, rc; |
613 | char *mem, *p; | 611 | char *mem, *p; |
614 | 612 | ||
615 | fd = open(file, O_RDONLY); | 613 | fd = open(conf->bindpwfile, O_RDONLY); |
616 | if (fd == -1) { | 614 | if (fd == -1) { |
617 | smap_error("can't open password file %s: %s", | 615 | smap_error("can't open password file %s: %s", |
618 | file, strerror(errno)); | 616 | conf->bindpwfile, strerror(errno)); |
619 | return -1; | 617 | return -1; |
620 | } | 618 | } |
621 | if (fstat(fd, &st)) { | 619 | if (fstat(fd, &st)) { |
622 | smap_error("can't stat password file %s: %s", | 620 | smap_error("can't stat password file %s: %s", |
623 | file, strerror(errno)); | 621 | conf->bindpwfile, strerror(errno)); |
624 | close(fd); | 622 | close(fd); |
625 | return -1; | 623 | return -1; |
626 | } | 624 | } |
@@ -631,7 +629,7 @@ get_passwd(struct ldap_conf *conf, struct berval *pwd, char **palloc) | |||
631 | close(fd); | 629 | close(fd); |
632 | return -1; | 630 | return -1; |
633 | } | 631 | } |
634 | rc = full_read(fd, file, mem, st.st_size); | 632 | rc = full_read(fd, conf->bindpwfile, mem, st.st_size); |
635 | close(fd); | 633 | close(fd); |
636 | if (rc) | 634 | if (rc) |
637 | return rc; | 635 | return rc; |
@@ -731,7 +729,6 @@ ldap_bind(LDAP *ld, struct ldap_conf *conf) | |||
731 | static smap_database_t | 729 | static smap_database_t |
732 | mod_ldap_init_db(const char *dbid, int argc, char **argv) | 730 | mod_ldap_init_db(const char *dbid, int argc, char **argv) |
733 | { | 731 | { |
734 | LDAP *ldap; | ||
735 | struct ldap_db *db; | 732 | struct ldap_db *db; |
736 | struct ldap_conf conf; | 733 | struct ldap_conf conf; |
737 | size_t i, j; | 734 | size_t i, j; |
@@ -880,7 +877,6 @@ getvar(const char *var, size_t len, void *data) | |||
880 | } | 877 | } |
881 | 878 | ||
882 | if (gd->ld) { | 879 | if (gd->ld) { |
883 | struct berval bv; | ||
884 | char *p; | 880 | char *p; |
885 | struct berval **values; | 881 | struct berval **values; |
886 | char *attr = malloc(len+1); | 882 | char *attr = malloc(len+1); |
@@ -989,12 +985,9 @@ mod_ldap_query(smap_database_t dbp, | |||
989 | { | 985 | { |
990 | struct ldap_db *db = (struct ldap_db *) dbp; | 986 | struct ldap_db *db = (struct ldap_db *) dbp; |
991 | char const *inenv[5]; | 987 | char const *inenv[5]; |
992 | char **env; | ||
993 | char **attrs; | ||
994 | struct wordsplit ws; | 988 | struct wordsplit ws; |
995 | ber_int_t msgid; | 989 | ber_int_t msgid; |
996 | int rc; | 990 | int rc; |
997 | char *reply = NULL; | ||
998 | LDAPMessage *res, *msg; | 991 | LDAPMessage *res, *msg; |
999 | 992 | ||
1000 | # define __smap_s_cat2__(a,b) a ## b | 993 | # define __smap_s_cat2__(a,b) a ## b |
diff --git a/src/smapc.c b/src/smapc.c index 88ddb0c..422afcd 100644 --- a/src/smapc.c +++ b/src/smapc.c | |||
@@ -650,7 +650,7 @@ read_eval_loop(FILE *fp, int interactive) | |||
650 | #endif | 650 | #endif |
651 | if (interactive && !quiet_startup) | 651 | if (interactive && !quiet_startup) |
652 | shell_banner(); | 652 | shell_banner(); |
653 | while (p = get_input_line(fp, interactive)) { | 653 | while ((p = get_input_line(fp, interactive))) { |
654 | #ifdef WITH_READLINE | 654 | #ifdef WITH_READLINE |
655 | if (interactive) { | 655 | if (interactive) { |
656 | if (retrieve_history(p)) | 656 | if (retrieve_history(p)) |
diff --git a/src/userprivs.c b/src/userprivs.c index 46e546f..eb424fe 100644 --- a/src/userprivs.c +++ b/src/userprivs.c | |||
@@ -70,7 +70,7 @@ get_user_groups(struct privinfo *pi) | |||
70 | user = pw->pw_name; | 70 | user = pw->pw_name; |
71 | 71 | ||
72 | setgrent(); | 72 | setgrent(); |
73 | while (gr = getgrent()) { | 73 | while ((gr = getgrent())) { |
74 | char **p; | 74 | char **p; |
75 |