View | Details | Raw Unified | Return to bug 22965
Collapse All | Expand All

(-)getcap.c (-11 / +13 lines)
Lines 62-70 Link Here
62
#define TCERR	(char)1
62
#define TCERR	(char)1
63
#define	SHADOW	(char)2
63
#define	SHADOW	(char)2
64
64
65
static size_t	 topreclen;	/* toprec length */
65
static size_t	 topreclen = 0;	/* toprec length */
66
static char	*toprec;	/* Additional record specified by cgetset() */
66
static char	*toprec = NULL;	/* Additional record specified by cgetset() */
67
static int	 gottoprec;	/* Flag indicating retrieval of toprecord */
67
static int	 gottoprec = 0;	/* Flag indicating retrieval of toprecord */
68
68
69
static int	cdbget __P((DB *, char **, char *));
69
static int	cdbget __P((DB *, char **, char *));
70
static int 	getent __P((char **, u_int *, char **, int, char *, int, char *));
70
static int 	getent __P((char **, u_int *, char **, int, char *, int, char *));
Lines 619-627 Link Here
619
	return (cgetnext(buf, db_array));
619
	return (cgetnext(buf, db_array));
620
}
620
}
621
621
622
static FILE *pfp;
622
static FILE *pfp = NULL;
623
static int slash;
623
static int slash = 0;		/* on if last line read-in ended with a '/' */
624
static char **dbp;
624
static char **dbp = NULL;
625
625
626
int
626
int
627
cgetclose()
627
cgetclose()
Lines 647-653 Link Here
647
	char **db_array;
647
	char **db_array;
648
{
648
{
649
	size_t len;
649
	size_t len;
650
	int status, i, done;
650
	int done, fcloseres, i, status;
651
	char *cp, *line, *rp, *np, buf[BSIZE], nbuf[BSIZE];
651
	char *cp, *line, *rp, *np, buf[BSIZE], nbuf[BSIZE];
652
	u_int dummy;
652
	u_int dummy;
653
653
Lines 665-672 Link Here
665
		} else {
665
		} else {
666
			line = fgetln(pfp, &len);
666
			line = fgetln(pfp, &len);
667
			if (line == NULL && pfp) {
667
			if (line == NULL && pfp) {
668
				(void)fclose(pfp);
668
				fcloseres = fclose(pfp);
669
				if (ferror(pfp)) {
669
				pfp = NULL;
670
				if (fcloseres != 0) {
670
					(void)cgetclose();
671
					(void)cgetclose();
671
					return (-1);
672
					return (-1);
672
				} else {
673
				} else {
Lines 724-731 Link Here
724
			} else { /* name field extends beyond the line */
725
			} else { /* name field extends beyond the line */
725
				line = fgetln(pfp, &len);
726
				line = fgetln(pfp, &len);
726
				if (line == NULL && pfp) {
727
				if (line == NULL && pfp) {
727
					(void)fclose(pfp);
728
					fcloseres = fclose(pfp);
728
					if (ferror(pfp)) {
729
					pfp = NULL;
730
					if (fcloseres != 0) {
729
						(void)cgetclose();
731
						(void)cgetclose();
730
						return (-1);
732
						return (-1);
731
					}
733
					}

Return to bug 22965