idx_t outsize = io_blksize (&stat_buf);
/* Device, I-node number and lazily-acquired flags of the output. */
- dev_t out_dev;
- ino_t out_ino;
+ struct
+ {
+ dev_t st_dev;
+ ino_t st_ino;
+ } out_id;
int out_flags = -2;
bool have_out_dev = ! (S_TYPEISSHM (&stat_buf) || S_TYPEISTMO (&stat_buf));
if (have_out_dev)
{
- out_dev = stat_buf.st_dev;
- out_ino = stat_buf.st_ino;
+ out_id.st_dev = stat_buf.st_dev;
+ out_id.st_ino = stat_buf.st_ino;
}
/* True if the output is a regular file. */
if (! (S_ISFIFO (stat_buf.st_mode) || S_ISSOCK (stat_buf.st_mode)
|| S_TYPEISSHM (&stat_buf) || S_TYPEISTMO (&stat_buf))
&& have_out_dev
- && stat_buf.st_dev == out_dev && stat_buf.st_ino == out_ino)
+ && SAME_INODE (stat_buf, out_id))
{
off_t in_pos = lseek (input_desc, 0, SEEK_CUR);
if (0 <= in_pos)
struct dir_list
{
struct dir_list *parent;
- ino_t ino;
- dev_t dev;
+ ino_t st_ino;
+ dev_t st_dev;
};
/* Initial size of the cp.dest_info hash table. */
{
while (ancestors != 0)
{
- if (ancestors->ino == sb->st_ino && ancestors->dev == sb->st_dev)
+ if (PSAME_INODE (ancestors, sb))
return true;
ancestors = ancestors->parent;
}
dir = alloca (sizeof *dir);
dir->parent = ancestors;
- dir->ino = src_sb.st_ino;
- dir->dev = src_sb.st_dev;
+ dir->st_ino = src_sb.st_ino;
+ dir->st_dev = src_sb.st_dev;
if (new_dst || !S_ISDIR (dst_sb.st_mode))
{
/* Attributes of the file the last time we checked. */
struct timespec mtime;
- dev_t dev;
- ino_t ino;
+ dev_t st_dev;
+ ino_t st_ino;
mode_t mode;
/* If a regular file, the file's read position the last time we
{
f->fd = fd;
f->mtime = get_stat_mtime (st);
- f->dev = st->st_dev;
- f->ino = st->st_ino;
+ f->st_dev = st->st_dev;
+ f->st_ino = st->st_ino;
f->mode = st->st_mode;
if (S_ISREG (st->st_mode))
f->read_pos = (read_pos < 0
_("%s has appeared; following new file"),
quoteaf (f->prettyname));
}
- else if (f->ino != new_stats.st_ino || f->dev != new_stats.st_dev)
+ else if (!SAME_INODE (*f, new_stats))
{
/* File has been replaced (e.g., via log rotation) --
tail the new one. */
struct stat stats;
if (! (stat (f[i].name, &stats) < 0
- || (f[i].dev == stats.st_dev && f[i].ino == stats.st_ino)))
+ || SAME_INODE (f[i], stats)))
{
error (0, errno, _("%s was replaced"),
quoteaf (f[i].prettyname));
f->fd = -1;
f->errnum = errno;
f->ignore = ! reopen_inaccessible_files;
- f->ino = 0;
- f->dev = 0;
+ f->st_dev = 0;
+ f->st_ino = 0;
}
error (0, errno, _("cannot open %s for reading"),
quoteaf (f->prettyname));
binary_operator (bool l_is_l, enum binop bop)
{
int op;
- struct stat stat_buf, stat_spare;
if (l_is_l)
advance (false);
case EF_BINOP:
if (l_is_l | r_is_l)
test_syntax_error (_("-ef does not accept -l"));
- return (stat (argv[op - 1], &stat_buf) == 0
- && stat (argv[op + 1], &stat_spare) == 0
- && SAME_INODE (stat_buf, stat_spare));
+ else
+ {
+ struct stat st[2];
+ return (stat (argv[op - 1], &st[0]) == 0
+ && stat (argv[op + 1], &st[1]) == 0
+ && psame_inode (&st[0], &st[1]));
+ }
case EQ_STRING_BINOP:
case NE_STRING_BINOP: