Skip to content

Commit

Permalink
[flow] Fix Female profile loading
Browse files Browse the repository at this point in the history
In gpiSaveDiskProfile we save client sex as follows:

if(profile->cache->sex == GP_MALE)
  fprintf(fp, "sex=Male\n");
if(profile->cache->sex == GP_FEMALE)
  fprintf(fp, "sex=Female\n");
if(profile->cache->sex == GP_PAT)
  fprintf(fp, "sex=Pat\n");

So to load client sex correctly we should inspect values at zero
index:

if(strcmp(key, "sex") == 0)
{
  if(toupper(value[0]) == 'M')
    infoCache.sex = GP_MALE;
  else if(toupper(value[0]) == 'F')
    infoCache.sex = GP_FEMALE;
  else // Assume Pat, not safe, but still.
    infoCache.sex = GP_PAT;
}
  • Loading branch information
dimhotepus committed Dec 18, 2020
1 parent d33f59e commit 8cb76cd
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ gpiReadDiskProfile(
{
if(toupper(value[0]) == 'M')
infoCache.sex = GP_MALE;
else if(toupper(value[1]) == 'F')
else if(toupper(value[0]) == 'F')
infoCache.sex = GP_FEMALE;
else
infoCache.sex = GP_PAT;
Expand Down

0 comments on commit 8cb76cd

Please sign in to comment.