Fix some compilation warnings:

* src/login.c: "dereferencing type-punned pointer will break
   strict-aliasing rules", add a variable indirection: ptr_pam_user.
 * lib/commonio.c: do not initialize the sb stat structure.
 * lib/pwio.c, lib/shadowio.c, lib/sgroupio.c, lib/groupio.c:
   initialize the security context if WITH_SELINUX.
 * lib/nscd.c: The service argument is not const (used in the exec*
   parameters). This matches with the prototype definition.
 * src/groupmems.c: Avoid ++i when i is also used in the same line.
 * src/newusers.c: i is positive every time it is compared. Add
   cast to unsigned int.
 * src/nologin.c: Use a main() prototype with no arguments.
 * libmisc/getdate.y: Initialize the type and value fields of the
   terminating entry for each TABLE.
 * libmisc/tz.c: Use "TZ=CST6CDT" as the default timezone.
This commit is contained in:
nekral-guest
2007-11-19 20:25:36 +00:00
parent d16cc1ea89
commit 39e5c0a1ab
13 changed files with 49 additions and 17 deletions

View File

@@ -126,7 +126,8 @@ static void rmfromgroup (char *user, char **members)
}
while (found && NULL != members[i]) {
members[i] = members[++i];
members[i] = members[i+1];
i++;
}
if (!found) {

View File

@@ -348,6 +348,7 @@ int main (int argc, char **argv)
int retcode;
pid_t child;
char *pam_user;
char **ptr_pam_user = &pam_user;
#else
struct spwd *spwd = NULL;
#endif
@@ -620,7 +621,7 @@ int main (int argc, char **argv)
/* if we didn't get a user on the command line,
set it to NULL */
pam_get_item (pamh, PAM_USER,
(const void **) &pam_user);
(const void **)ptr_pam_user);
if (pam_user[0] == '\0')
pam_set_item (pamh, PAM_USER, NULL);
@@ -644,7 +645,7 @@ int main (int argc, char **argv)
retcode = pam_authenticate (pamh, 0);
pam_get_item (pamh, PAM_USER,
(const void **) &pam_user);
(const void **) ptr_pam_user);
if (pam_user && pam_user[0]) {
pwd = xgetpwnam(pam_user);
@@ -737,7 +738,7 @@ int main (int argc, char **argv)
First get the username that we are actually using, though.
*/
retcode =
pam_get_item (pamh, PAM_USER, (const void **) &pam_user);
pam_get_item (pamh, PAM_USER, (const void **)ptr_pam_user);
setpwent ();
pwd = xgetpwnam (pam_user);
if (!pwd) {

View File

@@ -116,11 +116,11 @@ static int add_group (const char *name, const char *gid, gid_t * ngid)
if (gid[0] == '\0') {
i = 100;
for (pw_rewind (); (pwd = pw_next ());) {
if (pwd->pw_uid >= i)
if (pwd->pw_uid >= (unsigned int)i)
i = pwd->pw_uid + 1;
}
for (gr_rewind (); (grp = gr_next ());) {
if (grp->gr_gid == i) {
if (grp->gr_gid == (unsigned int)i) {
i = -1;
break;
}
@@ -133,7 +133,7 @@ static int add_group (const char *name, const char *gid, gid_t * ngid)
*/
i = atoi (gid);
for (gr_rewind (); (grp = gr_next ());)
if (grp->gr_gid == i)
if (grp->gr_gid == (unsigned int)i)
goto add_member;
} else
/*
@@ -149,7 +149,7 @@ static int add_group (const char *name, const char *gid, gid_t * ngid)
*/
if (i == -1) {
for (i = 100, gr_rewind (); (grp = gr_next ());)
if (grp->gr_gid >= i)
if (grp->gr_gid >= (unsigned int)i)
i = grp->gr_gid + 1;
}

View File

@@ -30,7 +30,7 @@
#include <unistd.h>
#include "exitcodes.h"
int main (int argc, char **argv)
int main ()
{
const char *user, *tty;