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>
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;
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;
}
case 'f':
arg_file = optarg;
break;
- case '?': printf("\n");
+ case '?':
case 'h':
+ printf("\n");
usage();
ret = 0;
goto exit;