+2010-03-11 Nicolas François <nicolas.francois@centraliens.net>
+
+ * lib/shadowio.c: Re-indent.
+ * lib/shadowio.c: Added brackets and parenthesis.
+ * lib/shadowio.c: Document the sections closed by #endif
+ * lib/shadowio.c: Avoid negation of comparisons.
+ * lib/shadowio.c: Avoid implicit conversion of integer to booleans
+ and booleans to integers.
+
2010-03-11 Nicolas François <nicolas.francois@centraliens.net>
* src/useradd.c: Re-indent.
#ifdef WITH_TCB
#include <tcb.h>
#include "tcbfuncs.h"
-#endif
+#endif /* WITH_TCB */
static /*@null@*/ /*@only@*/void *shadow_dup (const void *ent)
{
NULL, /* fp */
#ifdef WITH_SELINUX
NULL, /* scontext */
-#endif
+#endif /* WITH_SELINUX */
NULL, /* head */
NULL, /* tail */
NULL, /* cursor */
#ifdef WITH_TCB
int retval = 0;
- if (!getdef_bool("USE_TCB"))
-#endif
+ if (!getdef_bool ("USE_TCB")) {
+#endif /* WITH_TCB */
return commonio_lock (&shadow_db);
#ifdef WITH_TCB
- if (!shadowtcb_drop_priv())
+ }
+ if (shadowtcb_drop_priv () == 0) {
return 0;
- if (lckpwdf_tcb(shadow_db.filename) == 0) {
+ }
+ if (lckpwdf_tcb (shadow_db.filename) == 0) {
shadow_db.locked = 1;
retval = 1;
}
- if (!shadowtcb_gain_priv())
+ if (shadowtcb_gain_priv () == 0) {
return 0;
+ }
return retval;
-#endif
+#endif /* WITH_TCB */
}
int spw_open (int mode)
{
int retval = 0;
#ifdef WITH_TCB
- int use_tcb = getdef_bool("USE_TCB");
+ bool use_tcb = getdef_bool ("USE_TCB");
- if (use_tcb && !shadowtcb_drop_priv() != 0)
+ if (use_tcb && (shadowtcb_drop_priv () == 0)) {
return 0;
-#endif
+ }
+#endif /* WITH_TCB */
retval = commonio_open (&shadow_db, mode);
#ifdef WITH_TCB
- if (use_tcb && !shadowtcb_gain_priv() != 0)
+ if (use_tcb && (shadowtcb_gain_priv () == 0)) {
return 0;
-#endif
+ }
+#endif /* WITH_TCB */
return retval;
}
{
int retval = 0;
#ifdef WITH_TCB
- int use_tcb = getdef_bool("USE_TCB");
+ bool use_tcb = getdef_bool ("USE_TCB");
- if (use_tcb && !shadowtcb_drop_priv() != 0)
+ if (use_tcb && (shadowtcb_drop_priv () == 0)) {
return 0;
-#endif
+ }
+#endif /* WITH_TCB */
retval = commonio_close (&shadow_db);
#ifdef WITH_TCB
- if (use_tcb && !shadowtcb_gain_priv() != 0)
+ if (use_tcb && (shadowtcb_gain_priv () == 0)) {
return 0;
-#endif
+ }
+#endif /* WITH_TCB */
return retval;
}
#ifdef WITH_TCB
int retval = 0;
- if (!getdef_bool("USE_TCB"))
-#endif
+ if (!getdef_bool ("USE_TCB")) {
+#endif /* WITH_TCB */
return commonio_unlock (&shadow_db);
#ifdef WITH_TCB
- if (!shadowtcb_drop_priv())
+ }
+ if (shadowtcb_drop_priv () == 0) {
return 0;
- if (ulckpwdf_tcb() == 0) {
+ }
+ if (ulckpwdf_tcb () == 0) {
shadow_db.locked = 0;
retval = 1;
}
- if (!shadowtcb_gain_priv())
+ if (shadowtcb_gain_priv () == 0) {
return 0;
+ }
return retval;
-#endif
+#endif /* WITH_TCB */
}
struct commonio_entry *__spw_get_head (void)
int spw_sort ()
{
#ifdef WITH_TCB
- if (getdef_bool("USE_TCB"))
+ if (getdef_bool ("USE_TCB")) {
return 0;
-#endif
+ }
+#endif /* WITH_TCB */
return commonio_sort_wrt (&shadow_db, __pw_get_db ());
}