summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunmin Lee <sunm.lee@samsung.com>2017-09-28 19:05:07 +0900
committerMateusz Moscicki <m.moscicki2@partner.samsung.com>2018-05-07 13:24:16 +0200
commit194eeea2ada4a02a00e5fc6517ac6f9fd1e327a8 (patch)
treeacade2e28393d260644363966798cfe894415236
parent1d0d800b2129a1b2521ffc603fc247daffb18850 (diff)
downloadcrash-worker-194eeea2ada4a02a00e5fc6517ac6f9fd1e327a8.tar.gz
crash-worker-194eeea2ada4a02a00e5fc6517ac6f9fd1e327a8.tar.bz2
crash-worker-194eeea2ada4a02a00e5fc6517ac6f9fd1e327a8.zip
The documentation does not describe the behavior of the access() function for a NULL path argument, which can be returned by mkdtemp() Change-Id: I9c5c08eb424f5e9bdab248682b00e9cb895c7afa Signed-off-by: Sunmin Lee <sunm.lee@samsung.com> [ Cherry-picked from tizen_4.0 branch, extended commit message ] Signed-off-by: Mateusz Moscicki <m.moscicki2@partner.samsung.com>
-rw-r--r--src/crash-manager/crash-manager.c4
-rw-r--r--src/dump_systemstate/dump_systemstate.c3
2 files changed, 4 insertions, 3 deletions
diff --git a/src/crash-manager/crash-manager.c b/src/crash-manager/crash-manager.c
index 28d9cd0..cc409d4 100644
--- a/src/crash-manager/crash-manager.c
+++ b/src/crash-manager/crash-manager.c
@@ -256,7 +256,7 @@ error:
static int set_crash_info(int argc, char *argv[])
{
int ret;
- char *temp_dir_ret;
+ char *temp_dir_ret = NULL;
time_t time_val;
struct tm loc_tm;
@@ -283,7 +283,7 @@ static int set_crash_info(int argc, char *argv[])
return -1;
}
temp_dir_ret = mkdtemp(crash_info.temp_dir);
- if (access(temp_dir_ret, F_OK)) {
+ if (!temp_dir_ret || access(temp_dir_ret, F_OK)) {
_E("Failed to mkdtemp for temp_dir");
return -1;
}
diff --git a/src/dump_systemstate/dump_systemstate.c b/src/dump_systemstate/dump_systemstate.c
index 09467b1..0bf881e 100644
--- a/src/dump_systemstate/dump_systemstate.c
+++ b/src/dump_systemstate/dump_systemstate.c
@@ -106,8 +106,9 @@ int main(int argc, char *argv[])
case 'f':
arg_file = optarg;
break;
- case '?': printf("\n");
+ case '?':
case 'h':
+ printf("\n");
usage();
ret = 0;
goto exit;