1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

dtfile/Main.c: coverity CID 89623; uninit var

This commit is contained in:
Jon Trulson 2018-03-31 17:34:40 -06:00
parent e7269115b5
commit a8102e85e0

View file

@ -3420,17 +3420,16 @@ static void
GetPWD( GetPWD(
char current_directory[] ) char current_directory[] )
{ {
FILE * pwd_file; FILE * pwd_file = NULL;
register int i; int i = 0;
/* Open a pwd process and read the current working directory */ /* Open a pwd process and read the current working directory */
/* from it. If the open fails or a read fails, then display */ /* from it. If the open fails or a read fails, then display */
/* the users home directory. */ /* the users home directory. */
pwd_file = popen ("pwd", "r"); pwd_file = popen ("pwd", "r");
i = 0;
if (pwd_file != NULL) if (pwd_file)
{ {
while (1) while (1)
{ {
@ -3449,9 +3448,11 @@ GetPWD(
i++; i++;
} }
} }
(void) pclose (pwd_file);
current_directory[i] = '\0';
if (pwd_file)
pclose (pwd_file);
current_directory[i] = '\0';
} }
/************************************************************************ /************************************************************************