Client example: minor tweaks 87/277587/1
authorMichal Bloch <m.bloch@samsung.com>
Fri, 8 Jul 2022 12:36:45 +0000 (14:36 +0200)
committerMichal Bloch <m.bloch@samsung.com>
Fri, 8 Jul 2022 12:36:45 +0000 (14:36 +0200)
Change-Id: Id79209548f37171d2c0f521858c443a23688968d
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
clientExample/app/main.cpp

index c82dff8..4655bc5 100644 (file)
@@ -255,7 +255,7 @@ int main(int argc, char *argv[])
        }
 
        printf("No of registered users [%d/%zu]...", registered_users, usernames.size());
-       if (usernames.size() == registered_users)
+       if (usernames.size() == (unsigned) registered_users)
                green_print("ok");
        else
        {
@@ -263,8 +263,11 @@ int main(int argc, char *argv[])
                return EXIT_FAILURE;
        }
 
+       /* NB: the order of users as returned by get_user_list is unspecified
+        * and does not need to match the one in the original array above. */
        for (int i = 0; i < registered_users; ++i)
-               printf("%d -> %s\n", i, userlist[i]);
+               printf("%s\n", userlist[i]);
+
        ///===================================///
        printf("Switching users test...");
 
@@ -298,7 +301,7 @@ int main(int argc, char *argv[])
 
        ///======================================///
        printf("Removing users...");
-       if (!switch_user_test("")) {
+       if (!switch_user_test(SUBSESSION_INITIAL_SID)) {
                printf("Error setting user to starting\n");
                return EXIT_FAILURE;
        }