[HUST CSE][utest] fix the NULL pointer error
This commit is contained in:
parent
106f635552
commit
9a432c7413
|
@ -24,13 +24,16 @@ static int chdir_entry(void)
|
|||
printf("error\n");
|
||||
}
|
||||
ptr = getcwd(buf, size);
|
||||
printf("ptr %s\n",ptr);
|
||||
|
||||
if (ptr == NULL)
|
||||
{
|
||||
printf("error\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("ptr %s\n",ptr);
|
||||
printf("old curr dir is %s\n", ptr);
|
||||
}
|
||||
|
||||
mkdir(NEW_CURR_DIR, 0x777);
|
||||
chdir(NEW_CURR_DIR);
|
||||
|
@ -40,8 +43,12 @@ static int chdir_entry(void)
|
|||
{
|
||||
printf("error\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("new curr dir is %s\n", ptr);
|
||||
}
|
||||
|
||||
}
|
||||
free(buf);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue