#ifdef SARMAG
{
char buf[SARMAG];
- register int nread = read (desc, buf, SARMAG);
+ int nread;
+ EINTRLOOP (nread, read (desc, buf, SARMAG));
if (nread != SARMAG || memcmp (buf, ARMAG, SARMAG))
{
(void) close (desc);
#else
#ifdef AIAMAG
{
- register int nread = read (desc, &fl_header, FL_HSZ);
-
+ int nread;
+ EINTRLOOP (nread, read (desc, &fl_header, FL_HSZ));
if (nread != FL_HSZ)
{
(void) close (desc);
re-read the header into the "big" structure. */
if (!memcmp (fl_header.fl_magic, AIAMAGBIG, SAIAMAG))
{
+ off_t o;
+
big_archive = 1;
/* seek back to beginning of archive */
- if (lseek (desc, 0, 0) < 0)
+ EINTRLOOP (o, lseek (desc, 0, 0));
+ if (o < 0)
{
(void) close (desc);
return -2;
}
/* re-read the header into the "big" structure */
- nread = read (desc, &fl_header_big, FL_HSZ_BIG);
+ EINTRLOOP (nread, read (desc, &fl_header_big, FL_HSZ_BIG));
if (nread != FL_HSZ_BIG)
{
(void) close (desc);
#else
unsigned short int buf;
#endif
- register int nread = read (desc, &buf, sizeof (buf));
+ int nread;
+ EINTRLOOP (nread, read (desc, &buf, sizeof (buf)));
if (nread != sizeof (buf) || buf != ARMAG)
{
(void) close (desc);
long int eltsize;
int eltmode;
long int fnval;
+ off_t o;
- if (lseek (desc, member_offset, 0) < 0)
+ EINTRLOOP (o, lseek (desc, member_offset, 0));
+ if (o < 0)
{
(void) close (desc);
return -2;
#ifdef AIAMAGBIG
if (big_archive)
{
- nread = read (desc, &member_header_big,
- AR_MEMHDR_SZ(member_header_big) );
+ EINTRLOOP (nread, read (desc, &member_header_big,
+ AR_MEMHDR_SZ(member_header_big)));
if (nread != AR_MEMHDR_SZ(member_header_big))
{
}
sscanf (member_header_big.ar_namlen, "%4d", &name_len);
- nread = read (desc, name, name_len);
+ EINTRLOOP (nread, read (desc, name, name_len));
if (nread != name_len)
{
else
#endif
{
- nread = read (desc, &member_header,
- AR_MEMHDR_SZ(member_header) );
+ EINTRLOOP (nread, read (desc, &member_header,
+ AR_MEMHDR_SZ(member_header)));
if (nread != AR_MEMHDR_SZ(member_header))
{
}
sscanf (member_header.ar_namlen, "%4d", &name_len);
- nread = read (desc, name, name_len);
+ EINTRLOOP (nread, read (desc, name, name_len));
if (nread != name_len)
{
eltmode, arg);
#else /* Not AIAMAG. */
- nread = read (desc, &member_header, AR_HDR_SIZE);
+ EINTRLOOP (nread, read (desc, &member_header, AR_HDR_SIZE));
if (nread == 0)
/* No data left means end of file; that is OK. */
break;
int namesize = atoi (name + 3);
name = alloca (namesize + 1);
- nread = read (desc, name, namesize);
+ EINTRLOOP (nread, read (desc, name, namesize));
if (nread != namesize)
{
close (desc);
char *limit;
namemap = alloca (eltsize);
- nread = read (desc, namemap, eltsize);
+ EINTRLOOP (nread, read (desc, namemap, eltsize));
if (nread != eltsize)
{
(void) close (desc);
long int pos = ar_scan (arname, ar_member_pos, memname);
int fd;
struct ar_hdr ar_hdr;
- int i;
+ off_t o;
+ int r;
unsigned int ui;
struct stat statbuf;
if (!pos)
return 1;
- fd = open (arname, O_RDWR, 0666);
+ EINTRLOOP (fd, open (arname, O_RDWR, 0666));
if (fd < 0)
return -3;
/* Read in this member's header */
- if (lseek (fd, pos, 0) < 0)
+ EINTRLOOP (o, lseek (fd, pos, 0));
+ if (o < 0)
goto lose;
- if (AR_HDR_SIZE != read (fd, &ar_hdr, AR_HDR_SIZE))
+ EINTRLOOP (r, read (fd, &ar_hdr, AR_HDR_SIZE));
+ if (r != AR_HDR_SIZE)
goto lose;
/* Write back the header, thus touching the archive file. */
- if (lseek (fd, pos, 0) < 0)
+ EINTRLOOP (o, lseek (fd, pos, 0));
+ if (o < 0)
goto lose;
- if (AR_HDR_SIZE != write (fd, &ar_hdr, AR_HDR_SIZE))
+ EINTRLOOP (r, write (fd, &ar_hdr, AR_HDR_SIZE));
+ if (r != AR_HDR_SIZE)
goto lose;
/* The file's mtime is the time we we want. */
- EINTRLOOP (i, fstat (fd, &statbuf));
- if (i < 0)
+ EINTRLOOP (r, fstat (fd, &statbuf));
+ if (r < 0)
goto lose;
#if defined(ARFMAG) || defined(ARFZMAG) || defined(AIAMAG) || defined(WINDOWS32)
/* Advance member's time to that time */
for (ui = 0; ui < sizeof ar_hdr.ar_date; ui++)
ar_hdr.ar_date[ui] = ' ';
- sprintf (TOCHAR (ar_hdr.ar_date), "%ld", (long int) statbuf.st_mtime);
+ sprintf (TOCHAR (ar_hdr.ar_date), "%lu", (long unsigned) statbuf.st_mtime);
#ifdef AIAMAG
ar_hdr.ar_date[strlen (ar_hdr.ar_date)] = ' ';
#endif
ar_hdr.ar_date = statbuf.st_mtime;
#endif
/* Write back this member's header */
- if (lseek (fd, pos, 0) < 0)
+ EINTRLOOP (o, lseek (fd, pos, 0));
+ if (o < 0)
goto lose;
- if (AR_HDR_SIZE != write (fd, &ar_hdr, AR_HDR_SIZE))
+ EINTRLOOP (r, write (fd, &ar_hdr, AR_HDR_SIZE));
+ if (r != AR_HDR_SIZE)
goto lose;
close (fd);
return 0;
lose:
- i = errno;
+ r = errno;
close (fd);
- errno = i;
+ errno = r;
return -3;
}
#endif
pid = WAIT_NOHANG (&status);
else
#endif
- EINTRLOOP(pid, wait (&status));
+ EINTRLOOP (pid, wait (&status));
#endif /* !VMS */
}
else
if (job_rfd < 0)
{
DB (DB_JOBS, ("Duplicate the job FD\n"));
- job_rfd = dup (job_fds[0]);
+ EINTRLOOP (job_rfd, dup (job_fds[0]));
}
#endif
#else
/* Set interruptible system calls, and read() for a job token. */
set_child_handler_action_flags (1, waiting_jobs != NULL);
- got_token = read (job_rfd, &token, 1);
+ EINTRLOOP (got_token, read (job_rfd, &token, 1));
saved_errno = errno;
set_child_handler_action_flags (0, waiting_jobs != NULL);
#endif
child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
char **argv, char **envp)
{
+ int r;
+
/* For any redirected FD, dup2() it to the standard FD then close it. */
if (stdin_fd != FD_STDIN)
{
- dup2 (stdin_fd, FD_STDIN);
+ EINTRLOOP (r, dup2 (stdin_fd, FD_STDIN));
close (stdin_fd);
}
if (stdout_fd != FD_STDOUT)
- dup2 (stdout_fd, FD_STDOUT);
+ EINTRLOOP (r, dup2 (stdout_fd, FD_STDOUT));
if (stderr_fd != FD_STDERR)
- dup2 (stderr_fd, FD_STDERR);
+ EINTRLOOP (r, dup2 (stderr_fd, FD_STDERR));
if (stdout_fd != FD_STDOUT)
close (stdout_fd);
int fd;
(void) close (new);
- fd = dup (old);
+ EINTRLOOP (fd, dup (old));
if (fd != new)
{
(void) close (fd);
else
#endif
{
- int fd = open (file->name, O_RDWR | O_CREAT, 0666);
+ int fd;
+ EINTRLOOP (fd, open (file->name, O_RDWR | O_CREAT, 0666));
if (fd < 0)
TOUCH_ERROR ("touch: open: ");
else
if (e < 0)
TOUCH_ERROR ("touch: fstat: ");
/* Rewrite character 0 same as it already is. */
- if (read (fd, &buf, 1) < 0)
+ EINTRLOOP (e, read (fd, &buf, 1));
+ if (e < 0)
TOUCH_ERROR ("touch: read: ");
- if (lseek (fd, 0L, 0) < 0L)
- TOUCH_ERROR ("touch: lseek: ");
- if (write (fd, &buf, 1) < 0)
+ {
+ off_t o;
+ EINTRLOOP (o, lseek (fd, 0L, 0));
+ if (o < 0L)
+ TOUCH_ERROR ("touch: lseek: ");
+ }
+ EINTRLOOP (e, write (fd, &buf, 1));
+ if (e < 0)
TOUCH_ERROR ("touch: write: ");
- /* If file length was 0, we just
- changed it, so change it back. */
+
+ /* If file length was 0, we just changed it, so change it back. */
if (statbuf.st_size == 0)
{
(void) close (fd);
- fd = open (file->name, O_RDWR | O_TRUNC, 0666);
+ EINTRLOOP (fd, open (file->name, O_RDWR | O_TRUNC, 0666));
if (fd < 0)
TOUCH_ERROR ("touch: open: ");
}