Author: jra Date: 2005-10-18 18:02:05 +0000 (Tue, 18 Oct 2005) New Revision: 11154
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11154 Log: Remove warning in torturous logic. Jeremy. Modified: trunk/source/utils/net_idmap.c Changeset: Modified: trunk/source/utils/net_idmap.c =================================================================== --- trunk/source/utils/net_idmap.c 2005-10-18 17:21:43 UTC (rev 11153) +++ trunk/source/utils/net_idmap.c 2005-10-18 18:02:05 UTC (rev 11154) @@ -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; }