projects
/
lttng-tools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6c043b4
)
Fix: time of check time of use scenario
author
David Goulet
<dgoulet@efficios.com>
Wed, 12 Mar 2014 18:43:45 +0000
(14:43 -0400)
committer
David Goulet
<dgoulet@efficios.com>
Wed, 12 Mar 2014 18:43:45 +0000
(14:43 -0400)
Fixes coverity issue
1191753
.
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/common/config/config.c
patch
|
blob
|
blame
|
history
diff --git
a/src/common/config/config.c
b/src/common/config/config.c
index c952e8ba29180b4164638802b486c22244b0dd95..088d5b55a1b7e7c926f9ee4c0e1444a41b94ac38 100644
(file)
--- a/
src/common/config/config.c
+++ b/
src/common/config/config.c
@@
-2338,18
+2338,19
@@
int load_session_from_path(const char *path, const char *session_name,
struct session_config_validation_ctx *validation_ctx, int override)
{
int ret, session_found = !session_name;
struct session_config_validation_ctx *validation_ctx, int override)
{
int ret, session_found = !session_name;
- struct stat sb;
DIR *directory = NULL;
assert(path);
assert(validation_ctx);
DIR *directory = NULL;
assert(path);
assert(validation_ctx);
- ret = stat(path, &sb);
- if (ret) {
- ret = -LTTNG_ERR_LOAD_SESSION_NOENT;
- goto end;
+ directory = opendir(path);
+ if (!directory) {
+ if (errno != ENOTDIR) {
+ ret = -LTTNG_ERR_LOAD_IO_FAIL;
+ goto end;
+ }
}
}
- if (
S_ISDIR(sb.st_mode)
) {
+ if (
directory
) {
struct dirent *entry;
struct dirent *result;
char *file_path = NULL;
struct dirent *entry;
struct dirent *result;
char *file_path = NULL;
@@
-2366,13
+2367,6
@@
int load_session_from_path(const char *path, const char *session_name,
goto end;
}
goto end;
}
- directory = opendir(path);
- if (!directory) {
- ret = -LTTNG_ERR_LOAD_IO_FAIL;
- free(entry);
- goto end;
- }
-
file_path = zmalloc(PATH_MAX);
if (!file_path) {
ret = -LTTNG_ERR_NOMEM;
file_path = zmalloc(PATH_MAX);
if (!file_path) {
ret = -LTTNG_ERR_NOMEM;
@@
-2385,6
+2379,7
@@
int load_session_from_path(const char *path, const char *session_name,
file_path[path_len++] = '/';
}
file_path[path_len++] = '/';
}
+ ret = 0;
/* Search for *.lttng files */
while (!readdir_r(directory, entry, &result) && result) {
size_t file_name_len = strlen(result->d_name);
/* Search for *.lttng files */
while (!readdir_r(directory, entry, &result) && result) {
size_t file_name_len = strlen(result->d_name);
This page took
0.028729 seconds
and
4
git commands to generate.