mirror of
https://github.com/openbsd/src.git
synced 2026-06-18 15:23:33 +02:00
do not name FILE * variables "fd" since it is confusing
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: process.c,v 1.17 2004/03/10 04:32:45 deraadt Exp $ */
|
||||
/* $OpenBSD: process.c,v 1.18 2006/10/18 21:23:11 deraadt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983 Regents of the University of California.
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)process.c 5.10 (Berkeley) 2/26/91";*/
|
||||
static char rcsid[] = "$Id: process.c,v 1.17 2004/03/10 04:32:45 deraadt Exp $";
|
||||
static char rcsid[] = "$Id: process.c,v 1.18 2006/10/18 21:23:11 deraadt Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -195,21 +195,21 @@ find_user(char *name, char *tty, size_t ttyl)
|
||||
{
|
||||
struct utmp ubuf, ubuf1;
|
||||
int status;
|
||||
FILE *fd;
|
||||
FILE *fp;
|
||||
char line[UT_LINESIZE+1];
|
||||
char ftty[MAXPATHLEN];
|
||||
time_t idle, now;
|
||||
|
||||
time(&now);
|
||||
idle = INT_MAX;
|
||||
if ((fd = fopen(_PATH_UTMP, "r")) == NULL) {
|
||||
if ((fp = fopen(_PATH_UTMP, "r")) == NULL) {
|
||||
fprintf(stderr, "talkd: can't read %s.\n", _PATH_UTMP);
|
||||
return (FAILED);
|
||||
}
|
||||
#define SCMPN(a, b) strncmp(a, b, sizeof(a))
|
||||
status = NOT_HERE;
|
||||
(void) strlcpy(ftty, _PATH_DEV, sizeof(ftty));
|
||||
while (fread((char *) &ubuf, sizeof(ubuf), 1, fd) == 1)
|
||||
while (fread((char *) &ubuf, sizeof(ubuf), 1, fp) == 1)
|
||||
if (SCMPN(ubuf.ut_name, name) == 0) {
|
||||
if (*tty == '\0') {
|
||||
/* no particular tty was requested */
|
||||
@@ -234,7 +234,7 @@ find_user(char *name, char *tty, size_t ttyl)
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fd);
|
||||
fclose(fp);
|
||||
if (*tty == '\0' && status == SUCCESS) {
|
||||
memcpy(line, ubuf1.ut_line, UT_LINESIZE);
|
||||
line[sizeof(line)-1] = '\0';
|
||||
|
||||
+15
-14
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: ui.c,v 1.49 2006/09/19 10:48:41 otto Exp $ */
|
||||
/* $OpenBSD: ui.c,v 1.50 2006/10/18 21:18:59 deraadt Exp $ */
|
||||
/* $EOM: ui.c,v 1.43 2000/10/05 09:25:12 niklas Exp $ */
|
||||
|
||||
/*
|
||||
@@ -223,7 +223,7 @@ ui_config(char *cmd)
|
||||
char subcmd[81], section[81], tag[81], value[81], tmp[81];
|
||||
char *v, *nv;
|
||||
int trans = 0, items;
|
||||
FILE *fd;
|
||||
FILE *fp;
|
||||
|
||||
if (sscanf(cmd, "C %80s", subcmd) != 1)
|
||||
goto fail;
|
||||
@@ -232,11 +232,11 @@ ui_config(char *cmd)
|
||||
if (sscanf(cmd, "C %*s [%80[^]]]:%80s", section, tag) != 2)
|
||||
goto fail;
|
||||
v = conf_get_str(section, tag);
|
||||
fd = ui_open_result();
|
||||
if (fd) {
|
||||
fp = ui_open_result();
|
||||
if (fp) {
|
||||
if (v)
|
||||
fprintf(fd, "%s\n", v);
|
||||
fclose(fd);
|
||||
fprintf(fp, "%s\n", v);
|
||||
fclose(fp);
|
||||
}
|
||||
LOG_DBG((LOG_UI, 30, "ui_config: \"%s\"", cmd));
|
||||
return;
|
||||
@@ -410,15 +410,15 @@ ui_report(char *cmd)
|
||||
void
|
||||
ui_report_sa(char *cmd)
|
||||
{
|
||||
/* Skip 'cmd' as arg? */
|
||||
FILE *fp = ui_open_result();
|
||||
|
||||
FILE *fd = ui_open_result();
|
||||
if (!fd)
|
||||
/* Skip 'cmd' as arg? */
|
||||
if (!fp)
|
||||
return;
|
||||
|
||||
sa_report_all(fd);
|
||||
sa_report_all(fp);
|
||||
|
||||
fclose(fd);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -581,8 +581,9 @@ ui_handler(void)
|
||||
static FILE *
|
||||
ui_open_result(void)
|
||||
{
|
||||
FILE *fd = monitor_fopen(RESULT_FILE, "w");
|
||||
if (!fd)
|
||||
FILE *fp = monitor_fopen(RESULT_FILE, "w");
|
||||
|
||||
if (!fp)
|
||||
log_error("ui_open_result: fopen() failed");
|
||||
return fd;
|
||||
return fp;
|
||||
}
|
||||
|
||||
+11
-11
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: symtab.c,v 1.16 2005/11/15 07:02:35 miod Exp $ */
|
||||
/* $OpenBSD: symtab.c,v 1.17 2006/10/18 21:18:59 deraadt Exp $ */
|
||||
/* $NetBSD: symtab.c,v 1.10 1997/03/19 08:42:54 lukem Exp $ */
|
||||
|
||||
/*
|
||||
@@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)symtab.c 8.2 (Berkeley) 9/13/94";
|
||||
#else
|
||||
static const char rcsid[] = "$OpenBSD: symtab.c,v 1.16 2005/11/15 07:02:35 miod Exp $";
|
||||
static const char rcsid[] = "$OpenBSD: symtab.c,v 1.17 2006/10/18 21:18:59 deraadt Exp $";
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -442,18 +442,18 @@ dumpsymtable(char *filename, long checkpt)
|
||||
ino_t i;
|
||||
struct entry temp, *tentry;
|
||||
long mynum = 1, stroff = 0;
|
||||
FILE *fd;
|
||||
FILE *fp;
|
||||
struct symtableheader hdr;
|
||||
|
||||
Vprintf(stdout, "Check pointing the restore\n");
|
||||
if (Nflag)
|
||||
return;
|
||||
if ((fd = fopen(filename, "w")) == NULL) {
|
||||
if ((fp = fopen(filename, "w")) == NULL) {
|
||||
warn("fopen");
|
||||
panic("cannot create save file %s for symbol table\n",
|
||||
filename);
|
||||
}
|
||||
clearerr(fd);
|
||||
clearerr(fp);
|
||||
/*
|
||||
* Assign indices to each entry
|
||||
* Write out the string entries
|
||||
@@ -462,7 +462,7 @@ dumpsymtable(char *filename, long checkpt)
|
||||
for (ep = lookupino(i); ep != NULL; ep = ep->e_links) {
|
||||
ep->e_index = mynum++;
|
||||
(void)fwrite(ep->e_name, sizeof(char),
|
||||
(int)allocsize(ep->e_namlen), fd);
|
||||
(int)allocsize(ep->e_namlen), fp);
|
||||
}
|
||||
}
|
||||
/*
|
||||
@@ -488,7 +488,7 @@ dumpsymtable(char *filename, long checkpt)
|
||||
if (ep->e_next != NULL)
|
||||
tep->e_next =
|
||||
(struct entry *)ep->e_next->e_index;
|
||||
(void)fwrite((char *)tep, sizeof(struct entry), 1, fd);
|
||||
(void)fwrite((char *)tep, sizeof(struct entry), 1, fp);
|
||||
}
|
||||
}
|
||||
/*
|
||||
@@ -499,7 +499,7 @@ dumpsymtable(char *filename, long checkpt)
|
||||
tentry = NULL;
|
||||
else
|
||||
tentry = (struct entry *)entry[i]->e_index;
|
||||
(void)fwrite((char *)&tentry, sizeof(struct entry *), 1, fd);
|
||||
(void)fwrite((char *)&tentry, sizeof(struct entry *), 1, fp);
|
||||
}
|
||||
hdr.volno = checkpt;
|
||||
hdr.maxino = maxino;
|
||||
@@ -508,13 +508,13 @@ dumpsymtable(char *filename, long checkpt)
|
||||
hdr.dumptime = dumptime;
|
||||
hdr.dumpdate = dumpdate;
|
||||
hdr.ntrec = ntrec;
|
||||
(void)fwrite((char *)&hdr, sizeof(struct symtableheader), 1, fd);
|
||||
if (ferror(fd)) {
|
||||
(void)fwrite((char *)&hdr, sizeof(struct symtableheader), 1, fp);
|
||||
if (ferror(fp)) {
|
||||
warn("fwrite");
|
||||
panic("output error to file %s writing symbol table\n",
|
||||
filename);
|
||||
}
|
||||
(void)fclose(fd);
|
||||
(void)fclose(fp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+6
-6
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: acu.c,v 1.12 2006/03/17 14:43:06 moritz Exp $ */
|
||||
/* $OpenBSD: acu.c,v 1.13 2006/10/18 21:18:59 deraadt Exp $ */
|
||||
/* $NetBSD: acu.c,v 1.4 1996/12/29 10:34:03 cgd Exp $ */
|
||||
|
||||
/*
|
||||
@@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)acu.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
static const char rcsid[] = "$OpenBSD: acu.c,v 1.12 2006/03/17 14:43:06 moritz Exp $";
|
||||
static const char rcsid[] = "$OpenBSD: acu.c,v 1.13 2006/10/18 21:18:59 deraadt Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "tip.h"
|
||||
@@ -65,7 +65,7 @@ con(void)
|
||||
{
|
||||
char *cp = PN;
|
||||
char *phnum, string[256];
|
||||
FILE *fd;
|
||||
FILE *fp;
|
||||
volatile int tried = 0;
|
||||
|
||||
if (!DU) { /* regular connect message */
|
||||
@@ -114,11 +114,11 @@ con(void)
|
||||
tried++;
|
||||
}
|
||||
} else {
|
||||
if ((fd = fopen(PH, "r")) == NOFILE) {
|
||||
if ((fp = fopen(PH, "r")) == NOFILE) {
|
||||
printf("%s: ", PH);
|
||||
return ("can't open phone number file");
|
||||
}
|
||||
while (fgets(string, sizeof(string), fd) != NOSTR) {
|
||||
while (fgets(string, sizeof(string), fp) != NOSTR) {
|
||||
cp = &string[strcspn(string, " \t\n")];
|
||||
if (*cp != '\0')
|
||||
*cp++ = '\0';
|
||||
@@ -140,7 +140,7 @@ con(void)
|
||||
logent(value(HOST), phnum, acu->acu_name, "call failed");
|
||||
tried++;
|
||||
}
|
||||
fclose(fd);
|
||||
fclose(fp);
|
||||
}
|
||||
if (conflag) {
|
||||
if (CM != NOSTR)
|
||||
|
||||
+28
-28
@@ -38,7 +38,7 @@ static char copyright[] =
|
||||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)edquota.c 8.1 (Berkeley) 6/6/93";*/
|
||||
static char *rcsid = "$Id: edquota.c,v 1.44 2006/04/02 00:50:40 deraadt Exp $";
|
||||
static char *rcsid = "$Id: edquota.c,v 1.45 2006/10/18 21:18:59 deraadt Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -408,24 +408,24 @@ int
|
||||
writeprivs(struct quotause *quplist, int outfd, char *name, int quotatype)
|
||||
{
|
||||
struct quotause *qup;
|
||||
FILE *fd;
|
||||
FILE *fp;
|
||||
|
||||
ftruncate(outfd, 0);
|
||||
lseek(outfd, 0, SEEK_SET);
|
||||
if ((fd = fdopen(dup(outfd), "w")) == NULL)
|
||||
if ((fp = fdopen(dup(outfd), "w")) == NULL)
|
||||
err(1, "%s", tmpfil);
|
||||
(void)fprintf(fd, "Quotas for %s %s:\n", qfextension[quotatype], name);
|
||||
(void)fprintf(fp, "Quotas for %s %s:\n", qfextension[quotatype], name);
|
||||
for (qup = quplist; qup; qup = qup->next) {
|
||||
(void)fprintf(fd, "%s: %s %d, limits (soft = %d, hard = %d)\n",
|
||||
(void)fprintf(fp, "%s: %s %d, limits (soft = %d, hard = %d)\n",
|
||||
qup->fsname, "KBytes in use:",
|
||||
(int)(dbtob((u_quad_t)qup->dqblk.dqb_curblocks) / 1024),
|
||||
(int)(dbtob((u_quad_t)qup->dqblk.dqb_bsoftlimit) / 1024),
|
||||
(int)(dbtob((u_quad_t)qup->dqblk.dqb_bhardlimit) / 1024));
|
||||
(void)fprintf(fd, "%s %d, limits (soft = %d, hard = %d)\n",
|
||||
(void)fprintf(fp, "%s %d, limits (soft = %d, hard = %d)\n",
|
||||
"\tinodes in use:", qup->dqblk.dqb_curinodes,
|
||||
qup->dqblk.dqb_isoftlimit, qup->dqblk.dqb_ihardlimit);
|
||||
}
|
||||
fclose(fd);
|
||||
fclose(fp);
|
||||
return(1);
|
||||
}
|
||||
|
||||
@@ -436,24 +436,24 @@ int
|
||||
readprivs(struct quotause *quplist, int infd)
|
||||
{
|
||||
struct quotause *qup;
|
||||
FILE *fd;
|
||||
FILE *fp;
|
||||
int cnt;
|
||||
char *cp;
|
||||
struct dqblk dqblk;
|
||||
char *fsp, line1[BUFSIZ], line2[BUFSIZ];
|
||||
|
||||
lseek(infd, 0, SEEK_SET);
|
||||
fd = fdopen(dup(infd), "r");
|
||||
if (fd == NULL) {
|
||||
fp = fdopen(dup(infd), "r");
|
||||
if (fp == NULL) {
|
||||
warnx("can't re-read temp file!!");
|
||||
return(0);
|
||||
}
|
||||
/*
|
||||
* Discard title line, then read pairs of lines to process.
|
||||
*/
|
||||
(void)fgets(line1, sizeof (line1), fd);
|
||||
while (fgets(line1, sizeof (line1), fd) != NULL &&
|
||||
fgets(line2, sizeof (line2), fd) != NULL) {
|
||||
(void)fgets(line1, sizeof (line1), fp);
|
||||
while (fgets(line1, sizeof (line1), fp) != NULL &&
|
||||
fgets(line2, sizeof (line2), fp) != NULL) {
|
||||
if ((fsp = strtok(line1, " \t:")) == NULL) {
|
||||
warnx("%s: bad format", line1);
|
||||
return(0);
|
||||
@@ -521,7 +521,7 @@ readprivs(struct quotause *quplist, int infd)
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fd);
|
||||
fclose(fp);
|
||||
/*
|
||||
* Disable quotas for any filesystems that have not been found.
|
||||
*/
|
||||
@@ -545,24 +545,24 @@ int
|
||||
writetimes(struct quotause *quplist, int outfd, int quotatype)
|
||||
{
|
||||
struct quotause *qup;
|
||||
FILE *fd;
|
||||
FILE *fp;
|
||||
|
||||
ftruncate(outfd, 0);
|
||||
lseek(outfd, 0, SEEK_SET);
|
||||
if ((fd = fdopen(dup(outfd), "w")) == NULL)
|
||||
if ((fp = fdopen(dup(outfd), "w")) == NULL)
|
||||
err(1, "%s", tmpfil);
|
||||
(void)fprintf(fd,
|
||||
(void)fprintf(fp,
|
||||
"Time units may be: days, hours, minutes, or seconds\n");
|
||||
(void)fprintf(fd,
|
||||
(void)fprintf(fp,
|
||||
"Grace period before enforcing soft limits for %ss:\n",
|
||||
qfextension[quotatype]);
|
||||
for (qup = quplist; qup; qup = qup->next) {
|
||||
(void)fprintf(fd, "%s: block grace period: %s, ",
|
||||
(void)fprintf(fp, "%s: block grace period: %s, ",
|
||||
qup->fsname, cvtstoa(qup->dqblk.dqb_btime));
|
||||
(void)fprintf(fd, "file grace period: %s\n",
|
||||
(void)fprintf(fp, "file grace period: %s\n",
|
||||
cvtstoa(qup->dqblk.dqb_itime));
|
||||
}
|
||||
fclose(fd);
|
||||
fclose(fp);
|
||||
return(1);
|
||||
}
|
||||
|
||||
@@ -573,24 +573,24 @@ int
|
||||
readtimes(struct quotause *quplist, int infd)
|
||||
{
|
||||
struct quotause *qup;
|
||||
FILE *fd;
|
||||
FILE *fp;
|
||||
int cnt;
|
||||
char *cp;
|
||||
time_t itime, btime, iseconds, bseconds;
|
||||
char *fsp, bunits[10], iunits[10], line1[BUFSIZ];
|
||||
|
||||
lseek(infd, 0, SEEK_SET);
|
||||
fd = fdopen(dup(infd), "r");
|
||||
if (fd == NULL) {
|
||||
fp = fdopen(dup(infd), "r");
|
||||
if (fp == NULL) {
|
||||
warnx("can't re-read temp file!!");
|
||||
return(0);
|
||||
}
|
||||
/*
|
||||
* Discard two title lines, then read lines to process.
|
||||
*/
|
||||
(void)fgets(line1, sizeof (line1), fd);
|
||||
(void)fgets(line1, sizeof (line1), fd);
|
||||
while (fgets(line1, sizeof (line1), fd) != NULL) {
|
||||
(void)fgets(line1, sizeof (line1), fp);
|
||||
(void)fgets(line1, sizeof (line1), fp);
|
||||
while (fgets(line1, sizeof (line1), fp) != NULL) {
|
||||
if ((fsp = strtok(line1, " \t:")) == NULL) {
|
||||
warnx("%s: bad format", line1);
|
||||
return(0);
|
||||
@@ -620,7 +620,7 @@ readtimes(struct quotause *quplist, int infd)
|
||||
break;
|
||||
}
|
||||
}
|
||||
fclose(fd);
|
||||
fclose(fp);
|
||||
/*
|
||||
* reset default grace periods for any filesystems
|
||||
* that have not been found.
|
||||
|
||||
Reference in New Issue
Block a user