|
|
@ -1719,7 +1719,7 @@ void api_profile_list(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __ma |
|
|
|
struct profile *profile; |
|
|
|
struct profile *profile; |
|
|
|
char buf[TMPBUFSIZ]; |
|
|
|
char buf[TMPBUFSIZ]; |
|
|
|
bool io_open = false; |
|
|
|
bool io_open = false; |
|
|
|
bool b; |
|
|
|
bool b, default_done = false; |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
|
|
if (total_profiles == 0) |
|
|
|
if (total_profiles == 0) |
|
|
@ -1737,12 +1737,19 @@ void api_profile_list(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __ma |
|
|
|
{ |
|
|
|
{ |
|
|
|
//last profile is the default profile
|
|
|
|
//last profile is the default profile
|
|
|
|
if(i == total_profiles) |
|
|
|
if(i == total_profiles) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// if the default profile was already processed, skip posting it again
|
|
|
|
|
|
|
|
if(default_done) |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
profile = &default_profile; |
|
|
|
profile = &default_profile; |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
profile = profiles[i]; |
|
|
|
profile = profiles[i]; |
|
|
|
|
|
|
|
|
|
|
|
//if default profile name is profile name or loop index is beyond the last profile, then it is the default profile
|
|
|
|
//if default profile name is profile name or loop index is beyond the last profile, then it is the default profile
|
|
|
|
b = (((i == total_profiles) || (!strcasecmp(default_profile.name, profile->name)))?true:false); |
|
|
|
if((b = (((i == total_profiles) || (!strcasecmp(default_profile.name, profile->name)))?true:false))) |
|
|
|
|
|
|
|
default_done = true; |
|
|
|
|
|
|
|
|
|
|
|
root = api_add_int(root, "PROFILE", &i, false); |
|
|
|
root = api_add_int(root, "PROFILE", &i, false); |
|
|
|
root = api_add_escape(root, "Name", profile->name, true); |
|
|
|
root = api_add_escape(root, "Name", profile->name, true); |
|
|
|