mirror of
https://salsa.debian.org/srivasta/make-dfsg.git
synced 2025-02-12 07:07:39 +00:00
(name_mtime): Use safe_stat in place of stat.
(touch_file) [EINTR]: Do EINTR looping around fstat.
This commit is contained in:
parent
710e8e6f6f
commit
b574b8ea5a
1 changed files with 10 additions and 2 deletions
12
remake.c
12
remake.c
|
@ -777,8 +777,16 @@ touch_file (file)
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
char buf;
|
char buf;
|
||||||
|
int status;
|
||||||
|
|
||||||
if (fstat (fd, &statbuf) < 0)
|
#ifdef EINTR
|
||||||
|
do
|
||||||
|
#endif
|
||||||
|
status = fstat (fd, &statbuf);
|
||||||
|
#ifdef EINTR
|
||||||
|
while (status < 0 && errno == EINTR);
|
||||||
|
#endif
|
||||||
|
if (status < 0)
|
||||||
TOUCH_ERROR ("touch: fstat: ");
|
TOUCH_ERROR ("touch: fstat: ");
|
||||||
/* Rewrite character 0 same as it already is. */
|
/* Rewrite character 0 same as it already is. */
|
||||||
if (read (fd, &buf, 1) < 0)
|
if (read (fd, &buf, 1) < 0)
|
||||||
|
@ -971,7 +979,7 @@ name_mtime (name)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (stat (name, &st) < 0)
|
if (safe_stat (name, &st) < 0)
|
||||||
return (time_t) -1;
|
return (time_t) -1;
|
||||||
|
|
||||||
return (time_t) st.st_mtime;
|
return (time_t) st.st_mtime;
|
||||||
|
|
Loading…
Reference in a new issue