Author: jra Date: 2005-10-18 18:02:37 +0000 (Tue, 18 Oct 2005) New Revision: 11155
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11155 Log: Remove warning in torturous logic. Jeremy. Modified: branches/SAMBA_3_0/source/utils/net_idmap.c Changeset: Modified: branches/SAMBA_3_0/source/utils/net_idmap.c =================================================================== --- branches/SAMBA_3_0/source/utils/net_idmap.c 2005-10-18 18:02:05 UTC (rev 11154) +++ branches/SAMBA_3_0/source/utils/net_idmap.c 2005-10-18 18:02:37 UTC (rev 11155) @@ -84,18 +84,21 @@ void *handle) { struct hwms *hwms = (struct hwms *)handle; - int *idptr = NULL; + void *idptr = NULL; + BOOL isgid = False; int id; if (strncmp(key.dptr, "S-", 2) != 0) return 0; if (sscanf(data.dptr, "GID %d", &id) == 1) { - idptr = &hwms->group_hwm; + idptr = (void *)&hwms->group_hwm; + isgid = True; } if (sscanf(data.dptr, "UID %d", &id) == 1) { - idptr = &hwms->user_hwm; + idptr = (void *)&hwms->user_hwm; + isgid = False; } if (idptr == NULL) { @@ -105,8 +108,15 @@ return -1; } - if (*idptr <= id) - *idptr = id+1; + if (isgid) { + if (hwms->group_hwm <= (gid_t)id) { + hwms->group_hwm = (gid_t)(id+1); + } + } else { + if (hwms->user_hwm <= (uid_t)id) { + hwms->user_hwm = (uid_t)(id+1); + } + } return 0; }