X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Futils.c;h=e9fb552ac1011fc37569865baacb6fdbe29ca2de;hb=3e25d926e1c03011c68430e3a358d1e9a10ca9ab;hp=004cd8f0d1dcee02aa4b22a4e7f5c6f84a4618f7;hpb=7010c0332387eea98b52f301458d481f151840a6;p=lttng-tools.git diff --git a/src/common/utils.c b/src/common/utils.c index 004cd8f0d..e9fb552ac 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -755,7 +755,11 @@ static int utils_stream_file_name(char *path, strncpy(path, path_name_suffix, PATH_MAX - 1); path[PATH_MAX - 1] = '\0'; } else { - strncpy(path, full_path, PATH_MAX - 1); + ret = lttng_strncpy(path, full_path, PATH_MAX); + if (ret) { + ERR("Failed to copy stream file name"); + goto error_free_suffix; + } } path[PATH_MAX - 1] = '\0'; ret = 0; @@ -1487,15 +1491,17 @@ LTTNG_HIDDEN int utils_truncate_stream_file(int fd, off_t length) { int ret; + off_t lseek_ret; ret = ftruncate(fd, length); if (ret < 0) { PERROR("ftruncate"); goto end; } - ret = lseek(fd, length, SEEK_SET); - if (ret < 0) { + lseek_ret = lseek(fd, length, SEEK_SET); + if (lseek_ret < 0) { PERROR("lseek"); + ret = -1; goto end; } end: