Fix some file descriptor leaks. Closes PR# 2392.
2.2 candidate.
This commit is contained in:
parent
fbb488e831
commit
00f7ecb490
@ -757,12 +757,12 @@ ultimate_source (name, path)
|
|||||||
next:
|
next:
|
||||||
|
|
||||||
if ((fp = fopen (ult, "r")) == NULL)
|
if ((fp = fopen (ult, "r")) == NULL)
|
||||||
return buf;
|
|
||||||
|
|
||||||
if (fgets (buf, BUFSIZ, fp) == NULL)
|
|
||||||
return ult;
|
return ult;
|
||||||
|
|
||||||
if (strlen (buf) < 5)
|
end = fgets (buf, BUFSIZ, fp);
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
if (!end || strlen (buf) < 5)
|
||||||
return ult;
|
return ult;
|
||||||
|
|
||||||
beg = buf;
|
beg = buf;
|
||||||
@ -948,6 +948,7 @@ make_roff_command (file)
|
|||||||
{
|
{
|
||||||
cp = line;
|
cp = line;
|
||||||
fgets (line, BUFSIZ, fp);
|
fgets (line, BUFSIZ, fp);
|
||||||
|
fclose(fp);
|
||||||
if (*cp++ == '\'' && *cp++ == '\\' && *cp++ == '"' && *cp++ == ' ')
|
if (*cp++ == '\'' && *cp++ == '\\' && *cp++ == '"' && *cp++ == ' ')
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -955,8 +956,6 @@ make_roff_command (file)
|
|||||||
|
|
||||||
status = parse_roff_directive (cp, file, buf, sizeof(buf));
|
status = parse_roff_directive (cp, file, buf, sizeof(buf));
|
||||||
|
|
||||||
fclose (fp);
|
|
||||||
|
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
return buf;
|
return buf;
|
||||||
|
|
||||||
|
@ -202,9 +202,11 @@ get_dirlist ()
|
|||||||
|
|
||||||
if (!strncmp ("MANDATORY_MANPATH", bp, 17))
|
if (!strncmp ("MANDATORY_MANPATH", bp, 17))
|
||||||
{
|
{
|
||||||
if ((p = strchr (bp, ' ')) == NULL)
|
if ((p = strchr (bp, ' ')) == NULL &&
|
||||||
if ((p = strchr (bp, '\t')) == NULL)
|
(p = strchr (bp, '\t')) == NULL) {
|
||||||
return -1;
|
fclose(config);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
bp = p;
|
bp = p;
|
||||||
|
|
||||||
@ -224,9 +226,11 @@ get_dirlist ()
|
|||||||
}
|
}
|
||||||
else if (!strncmp ("MANPATH_MAP", bp, 11))
|
else if (!strncmp ("MANPATH_MAP", bp, 11))
|
||||||
{
|
{
|
||||||
if ((p = strchr (bp, ' ')) == NULL)
|
if ((p = strchr (bp, ' ')) == NULL &&
|
||||||
if ((p = strchr (bp, '\t')) == NULL)
|
(p = strchr (bp, '\t')) == NULL) {
|
||||||
return -1;
|
fclose(config);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
bp = p;
|
bp = p;
|
||||||
|
|
||||||
@ -259,6 +263,7 @@ get_dirlist ()
|
|||||||
dlp++;
|
dlp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose(config);
|
||||||
dlp->bin[0] = '\0';
|
dlp->bin[0] = '\0';
|
||||||
dlp->mandir[0] = '\0';
|
dlp->mandir[0] = '\0';
|
||||||
dlp->mandatory = 0;
|
dlp->mandatory = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user