aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2017-11-10 11:08:35 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2017-11-10 11:08:35 +0200
commit2f1214a79a6befb629466c3e81a993123733a2fe (patch)
treeacf5e1cc9289cf4b655aa873d0b01642090b1391
parent3457c19206858d3e8155dcfc776df8818d05824b (diff)
downloadsmap-2f1214a79a6befb629466c3e81a993123733a2fe.tar.gz
smap-2f1214a79a6befb629466c3e81a993123733a2fe.tar.bz2
Placate cc warnings
-rw-r--r--lib/parseopt.c5
-rw-r--r--lib/sockmapstr.c2
-rw-r--r--lib/stream.c4
-rw-r--r--modules/ldap/ldap.c23
-rw-r--r--src/smapc.c2
-rw-r--r--src/userprivs.c2
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 @@
/* This file is part of Smap.
- Copyright (C) 2008, 2010, 2014 Sergey Poznyakoff
+ Copyright (C) 2008, 2010, 2014, 2017 Sergey Poznyakoff
Smap is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,6 +20,7 @@
#include <smap/parseopt.h>
#include <smap/diag.h>
#include <string.h>
+#include <ctype.h>
static struct smap_option const *
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,
int *pindex)
{
int i;
- long n;
- char *s;
int rc = 0;
const char *modname = argv[0];
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)
if (n == 0)
return EOF;
len += n;
- if (p = memchr(sp->nbuf, ':', len)) {
+ if ((p = memchr(sp->nbuf, ':', len))) {
sp->cp = p - sp->nbuf;
sp->nbuf[len] = 0;
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)
}
if (stream->level) {
if (all) {
- if (rc = _force_flush_buffer(stream))
+ if ((rc = _force_flush_buffer(stream)))
return rc;
} else if (BUFFER_FULL_P(stream)) {
if (stream->flags & SMAP_STREAM_EXPBUF)
return _stream_realloc_buffer(stream, 0);
- if (rc = _force_flush_buffer(stream))
+ if ((rc = _force_flush_buffer(stream)))
return rc;
}
}
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)
for (n = 0; a[n]; n++)
;
- b = calloc(i + 1, sizeof(b[0]));
+ b = calloc(n + 1, sizeof(b[0]));
if (!b)
return -1;
for (i = 0; i < n; i++) {
@@ -200,7 +200,7 @@ parse_ldap_conf(const char *name, struct smap_option const *opt)
}
line = 0;
- while (p = fgets(buf, sizeof(buf), fp)) {
+ while ((p = fgets(buf, sizeof(buf), fp))) {
size_t len;
char *errmsg;
@@ -254,6 +254,7 @@ parse_ldap_conf(const char *name, struct smap_option const *opt)
return rc;
}
+#if 0
static int
readconf(struct smap_option const *opt, const char *val, char **errmsg)
{
@@ -262,6 +263,7 @@ readconf(struct smap_option const *opt, const char *val, char **errmsg)
*errmsg = "parse error";
return rc;
}
+#endif
#define MKOPT_DEFAULT 0
#define MKOPT_REUSE 0x01
@@ -502,8 +504,6 @@ ldap_connect(struct ldap_conf *conf)
int rc;
char *ldapuri = NULL;
LDAP *ld = NULL;
- char *val;
- unsigned long lval;
if (ldap_debug_level) {
if (ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL,
@@ -605,22 +605,20 @@ full_read(int fd, char *file, char *buf, size_t size)
static int
get_passwd(struct ldap_conf *conf, struct berval *pwd, char **palloc)
{
- char *file;
-
if (conf->bindpwfile) {
struct stat st;
int fd, rc;
char *mem, *p;
- fd = open(file, O_RDONLY);
+ fd = open(conf->bindpwfile, O_RDONLY);
if (fd == -1) {
smap_error("can't open password file %s: %s",
- file, strerror(errno));
+ conf->bindpwfile, strerror(errno));
return -1;
}
if (fstat(fd, &st)) {
smap_error("can't stat password file %s: %s",
- file, strerror(errno));
+ conf->bindpwfile, strerror(errno));
close(fd);
return -1;
}
@@ -631,7 +629,7 @@ get_passwd(struct ldap_conf *conf, struct berval *pwd, char **palloc)
close(fd);
return -1;
}
- rc = full_read(fd, file, mem, st.st_size);
+ rc = full_read(fd, conf->bindpwfile, mem, st.st_size);
close(fd);
if (rc)
return rc;
@@ -731,7 +729,6 @@ ldap_bind(LDAP *ld, struct ldap_conf *conf)
static smap_database_t
mod_ldap_init_db(const char *dbid, int argc, char **argv)
{
- LDAP *ldap;
struct ldap_db *db;
struct ldap_conf conf;
size_t i, j;
@@ -880,7 +877,6 @@ getvar(const char *var, size_t len, void *data)
}
if (gd->ld) {
- struct berval bv;
char *p;
struct berval **values;
char *attr = malloc(len+1);
@@ -989,12 +985,9 @@ mod_ldap_query(smap_database_t dbp,
{
struct ldap_db *db = (struct ldap_db *) dbp;
char const *inenv[5];
- char **env;
- char **attrs;
struct wordsplit ws;
ber_int_t msgid;
int rc;
- char *reply = NULL;
LDAPMessage *res, *msg;
# 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)
#endif
if (interactive && !quiet_startup)
shell_banner();
- while (p = get_input_line(fp, interactive)) {
+ while ((p = get_input_line(fp, interactive))) {
#ifdef WITH_READLINE
if (interactive) {
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)
user = pw->pw_name;
setgrent();
- while (gr = getgrent()) {
+ while ((gr = getgrent())) {
char **p;
for (p = gr->gr_mem; *p; p++)
if (strcmp(*p, user) == 0) {

Return to:

Send suggestions and report system problems to the System administrator.