libpwdgrp: use a better estimate of max struct size

Previous code's trick with bitwise OR was giving this on 32-bit x86:

sizeof(struct passwd):28
sizeof(struct group):16
sizeof(struct spwd):36
sizeof(struct_result):60

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2015-01-03 17:53:49 +01:00
parent 9dca6acaac
commit 5e62a3d016

View File

@ -45,11 +45,10 @@ struct passdb {
uint8_t numfields; uint8_t numfields;
FILE *fp; FILE *fp;
char *malloced; char *malloced;
char struct_result[0 char struct_result[
| sizeof(struct passwd) /* Should be max(sizeof passwd,group,spwd), but this will do: */
| sizeof(struct group) IF_NOT_USE_BB_SHADOW(sizeof(struct passwd))
IF_USE_BB_SHADOW( | sizeof(struct spwd) ) IF_USE_BB_SHADOW(sizeof(struct spwd))
/* bitwise OR above is poor man's max(a,b,c) */
]; ];
}; };