projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixes two nasty problems, both pointed out by Bill Nowicki at Stanford:
[unix-history]
/
usr
/
src
/
usr.sbin
/
sendmail
/
src
/
util.c
diff --git
a/usr/src/usr.sbin/sendmail/src/util.c
b/usr/src/usr.sbin/sendmail/src/util.c
index
38dce51
..
d3d1c7c
100644
(file)
--- a/
usr/src/usr.sbin/sendmail/src/util.c
+++ b/
usr/src/usr.sbin/sendmail/src/util.c
@@
-8,7
+8,7
@@
# include "sendmail.h"
# include "conf.h"
# include "sendmail.h"
# include "conf.h"
-SCCSID(@(#)util.c 4.
2
%G%);
+SCCSID(@(#)util.c 4.
3
%G%);
/*
** STRIPQUOTES -- Strip quotes & quote bits from a string.
/*
** STRIPQUOTES -- Strip quotes & quote bits from a string.
@@
-617,7
+617,8
@@
xunlink(f)
** fp -- file to read from.
**
** Returns:
** fp -- file to read from.
**
** Returns:
-** NULL on error (including timeout).
+** NULL on error (including timeout). This will also leave
+** buf containing a null string.
** buf otherwise.
**
** Side Effects:
** buf otherwise.
**
** Side Effects:
@@
-648,17
+649,22
@@
sfgets(buf, siz, fp)
}
/* try to read */
}
/* try to read */
- do
+ p = NULL;
+ while (p == NULL && !feof(fp) && !ferror(fp))
{
errno = 0;
p = fgets(buf, siz, fp);
{
errno = 0;
p = fgets(buf, siz, fp);
- } while (p == NULL && errno == EINTR);
+ if (errno == EINTR)
+ clearerr(fp);
+ }
/* clear the event if it has not sprung */
clrevent(ev);
/* clean up the books and exit */
LineNumber++;
/* clear the event if it has not sprung */
clrevent(ev);
/* clean up the books and exit */
LineNumber++;
+ if (p == NULL)
+ buf[0] = '\0';
return (p);
}
return (p);
}