* src/groupmod.c: Ignore return value from snprintf.

* src/groupmod.c: Add static qualifier to the cleanup structures.
This commit is contained in:
nekral-guest 2011-08-15 14:22:33 +00:00
parent 7c96d6cbcc
commit 7f842bdf4f
2 changed files with 30 additions and 21 deletions

View File

@ -1,3 +1,8 @@
2011-08-15 Nicolas François <nicolas.francois@centraliens.net>
* src/groupmod.c: Ignore return value from snprintf.
* src/groupmod.c: Add static qualifier to the cleanup structures.
2011-08-15 Nicolas François <nicolas.francois@centraliens.net> 2011-08-15 Nicolas François <nicolas.francois@centraliens.net>
* src/usermod.c: Do not assign static to NULL. * src/usermod.c: Do not assign static to NULL.

View File

@ -80,10 +80,10 @@ static char *group_passwd;
static gid_t group_id; static gid_t group_id;
static gid_t group_newid; static gid_t group_newid;
struct cleanup_info_mod info_passwd; static struct cleanup_info_mod info_passwd;
struct cleanup_info_mod info_group; static struct cleanup_info_mod info_group;
#ifdef SHADOWGRP #ifdef SHADOWGRP
struct cleanup_info_mod info_gshadow; static struct cleanup_info_mod info_gshadow;
#endif #endif
static bool static bool
@ -522,14 +522,14 @@ static void prepare_failure_reports (void)
#endif #endif
info_passwd.audit_msg = xmalloc (512); info_passwd.audit_msg = xmalloc (512);
snprintf (info_group.audit_msg, 511, (void) snprintf (info_group.audit_msg, 511,
"changing %s; ", gr_dbname ()); "changing %s; ", gr_dbname ());
#ifdef SHADOWGRP #ifdef SHADOWGRP
snprintf (info_gshadow.audit_msg, 511, (void) snprintf (info_gshadow.audit_msg, 511,
"changing %s; ", sgr_dbname ()); "changing %s; ", sgr_dbname ());
#endif #endif
snprintf (info_passwd.audit_msg, 511, (void) snprintf (info_passwd.audit_msg, 511,
"changing %s; ", pw_dbname ()); "changing %s; ", pw_dbname ());
info_group.action = info_group.audit_msg info_group.action = info_group.audit_msg
+ strlen (info_group.audit_msg); + strlen (info_group.audit_msg);
@ -540,14 +540,18 @@ static void prepare_failure_reports (void)
info_passwd.action = info_passwd.audit_msg info_passwd.action = info_passwd.audit_msg
+ strlen (info_passwd.audit_msg); + strlen (info_passwd.audit_msg);
snprintf (info_group.action, 511 - strlen (info_group.audit_msg), (void) snprintf (info_group.action,
"group %s/%lu", group_name, (unsigned long int) group_id); 511 - strlen (info_group.audit_msg),
"group %s/%lu",
group_name, (unsigned long int) group_id);
#ifdef SHADOWGRP #ifdef SHADOWGRP
snprintf (info_gshadow.action, 511 - strlen (info_group.audit_msg), (void) snprintf (info_gshadow.action,
"group %s", group_name); 511 - strlen (info_group.audit_msg),
"group %s", group_name);
#endif #endif
snprintf (info_passwd.action, 511 - strlen (info_group.audit_msg), (void) snprintf (info_passwd.action,
"group %s/%lu", group_name, (unsigned long int) group_id); 511 - strlen (info_group.audit_msg),
"group %s/%lu", group_name, (unsigned long int) group_id);
if (nflg) { if (nflg) {
strncat (info_group.action, ", new name: ", strncat (info_group.action, ", new name: ",
@ -579,15 +583,15 @@ static void prepare_failure_reports (void)
if (gflg) { if (gflg) {
strncat (info_group.action, ", new gid: ", strncat (info_group.action, ", new gid: ",
511 - strlen (info_group.audit_msg)); 511 - strlen (info_group.audit_msg));
snprintf (info_group.action+strlen (info_group.action), (void) snprintf (info_group.action+strlen (info_group.action),
511 - strlen (info_group.audit_msg), 511 - strlen (info_group.audit_msg),
"%lu", (unsigned long int) group_newid); "%lu", (unsigned long int) group_newid);
strncat (info_passwd.action, ", new gid: ", strncat (info_passwd.action, ", new gid: ",
511 - strlen (info_passwd.audit_msg)); 511 - strlen (info_passwd.audit_msg));
snprintf (info_passwd.action+strlen (info_passwd.action), (void) snprintf (info_passwd.action+strlen (info_passwd.action),
511 - strlen (info_passwd.audit_msg), 511 - strlen (info_passwd.audit_msg),
"%lu", (unsigned long int) group_newid); "%lu", (unsigned long int) group_newid);
} }
info_group.audit_msg[511] = '\0'; info_group.audit_msg[511] = '\0';
#ifdef SHADOWGRP #ifdef SHADOWGRP