aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2016-08-20 08:49:23 +0300
committerSergey Poznyakoff <gray@gnu.org>2016-08-20 08:49:23 +0300
commitcbda0991bc80384d2b0a795bbbbf2040b24e69eb (patch)
treebb59dad8229197b6dd1c98199d92c8292b9f0d5b
parent3ea52272c8ffa360b01af63d5a50f9442a596fc5 (diff)
downloadrush-cbda0991bc80384d2b0a795bbbbf2040b24e69eb.tar.gz
rush-cbda0991bc80384d2b0a795bbbbf2040b24e69eb.tar.bz2
Bugfixes
-rw-r--r--src/getopt.m44
-rw-r--r--src/limits.c17
-rw-r--r--src/rush.c2
-rw-r--r--src/rush.h2
-rw-r--r--tests/myid.c3
5 files changed, 14 insertions, 14 deletions
diff --git a/src/getopt.m4 b/src/getopt.m4
index 927bb3d..aa60291 100644
--- a/src/getopt.m4
+++ b/src/getopt.m4
@@ -214,8 +214,8 @@ print_option_descr (const char *descr, size_t lmargin, size_t rmargin)
{
while (*descr)
{
- size_t s = 0;
- size_t i;
+ int s = 0;
+ int i;
size_t width = rmargin - lmargin;
for (i = 0; ; i++)
diff --git a/src/limits.c b/src/limits.c
index 4cef0c1..1f7d95e 100644
--- a/src/limits.c
+++ b/src/limits.c
@@ -41,7 +41,7 @@ struct limits_rec {
rlim_t limit_nofile;
rlim_t limit_rss;
rlim_t limit_stack;
- int limit_logins;
+ size_t limit_logins;
int limit_prio;
};
@@ -76,7 +76,7 @@ set_prio(int prio)
/* Counts the number of user logins and check against the limit */
static int
-check_logins(const char *name, int limit)
+check_logins(const char *name, size_t limit)
{
size_t count = 0;
struct rush_wtmp *wtmp = 0;
@@ -116,16 +116,16 @@ check_logins(const char *name, int limit)
rushdb_close();
- debug(3, _("counted %d/%d logins for %s"), count, limit, name);
+ debug(3, _("counted %zu/%zu logins for %s"), count, limit, name);
/*
* This is called after setutmp(), so the number of logins counted
* includes the user who is currently trying to log in.
*/
if (count >= limit) {
- debug(2, _("Too many logins (max %d) for %s"),
+ debug(2, _("Too many logins (max %zu) for %s"),
limit, name);
- logmsg(LOG_ERR, _("Too many logins (max %d) for %s"),
+ logmsg(LOG_ERR, _("Too many logins (max %zu) for %s"),
limit, name);
return 1;
}
@@ -185,7 +185,7 @@ set_user_limits(const char *name, struct limits_rec *lrec)
if (lrec->set & SET_LIMIT_LOGINS)
rc |= check_logins(name, lrec->limit_logins);
if (lrec->set & SET_LIMIT_PRIO)
- rc |= set_prio(lrec->limit_logins);
+ rc |= set_prio(lrec->limit_prio);
return rc;
}
@@ -303,9 +303,8 @@ parse_limits(limits_record_t *plrec, char *str, char **endp)
break;
case 'l':
case 'L':
- lrec->limit_logins = strtol(str, &str, 10);
- if (lrec->limit_logins >= 0)
- lrec->set |= SET_LIMIT_LOGINS;
+ lrec->limit_logins = strtoul(str, &str, 10);
+ lrec->set |= SET_LIMIT_LOGINS;
break;
case 'p':
case 'P':
diff --git a/src/rush.c b/src/rush.c
index 17ddb3b..fd83faa 100644
--- a/src/rush.c
+++ b/src/rush.c
@@ -418,7 +418,7 @@ env_concat(char *name, size_t namelen, char *a, char *b)
if (a && b) {
res = xmalloc(namelen + 1 + strlen(a) + strlen(b) + 1);
strcpy(res + namelen + 1, a);
- strcat(res, b);
+ strcat(res + namelen + 1, b);
} else if (a) {
len = strlen(a);
if (c_ispunct(a[len-1]))
diff --git a/src/rush.h b/src/rush.h
index ac4c3b7..0bc57ab 100644
--- a/src/rush.h
+++ b/src/rush.h
@@ -180,7 +180,7 @@ struct rush_rule {
/* Source location */
const char *file; /* Configuration file name */
- size_t line; /* and line number. */
+ int line; /* and line number. */
/* Match parameters */
struct test_node *test_head, *test_tail;
diff --git a/tests/myid.c b/tests/myid.c
index 5b8bb7e..f13bb4b 100644
--- a/tests/myid.c
+++ b/tests/myid.c
@@ -1,3 +1,4 @@
+#include <unistd.h>
#include <stdio.h>
#include <pwd.h>
#include <grp.h>
@@ -13,7 +14,7 @@ main(int argc, char **argv)
assert(pw!=NULL);
gr = getgrgid(pw->pw_gid);
assert(gr!=NULL);
- printf("%s %ul %s %ul\n",
+ printf("%s %lu %s %lu\n",
pw->pw_name,
(unsigned long) pw->pw_uid,
gr->gr_name,

Return to:

Send suggestions and report system problems to the System administrator.