Fix: handle signed return value for snprintf
authorDavid Goulet <dgoulet@efficios.com>
Mon, 10 Mar 2014 20:18:42 +0000 (16:18 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Mon, 10 Mar 2014 20:18:42 +0000 (16:18 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/save.c

index 8599d2d18a6796bc3c6ba90017f4ea55420c0d6d..2d8af38217754916ea7080dba0604f479c88027a 100644 (file)
@@ -1425,6 +1425,7 @@ int save_session(struct ltt_session *session,
                }
                strncpy(config_file_path, provided_path, len);
        } else {
+               ssize_t ret_len;
                char *home_dir = utils_get_user_home_dir(
                        LTTNG_SOCK_GET_UID_CRED(creds));
                if (!home_dir) {
@@ -1432,14 +1433,15 @@ int save_session(struct ltt_session *session,
                        goto end;
                }
 
-               len = snprintf(config_file_path, PATH_MAX,
+               ret_len = snprintf(config_file_path, PATH_MAX,
                                DEFAULT_SESSION_HOME_CONFIGPATH, home_dir);
                free(home_dir);
-               if (len < 0) {
+               if (ret_len < 0) {
                        PERROR("snprintf save session");
                        ret = LTTNG_ERR_SET_URL;
                        goto end;
                }
+               len = ret_len;
        }
 
        /*
This page took 0.02658 seconds and 4 git commands to generate.