pid_t sys_child_open_for_uncompress (void);
idx_t sys_write_archive_buffer (void);
bool sys_get_archive_stat (void);
-int sys_exec_command (char *file_name, int typechar, struct tar_stat_info *st);
+int sys_exec_command (char *file_name, char typechar, struct tar_stat_info *st);
void sys_wait_command (void);
int sys_exec_info_script (const char **archive_name, intmax_t volume_number);
void sys_exec_checkpoint_script (const char *script_name,
const char *archive_name,
intmax_t checkpoint_number);
bool mtioseek (bool count_files, off_t count);
-int sys_exec_setmtime_script (const char *script_name,
- int dirfd,
- const char *file_name,
- const char *fmt,
- struct timespec *ts);
+bool sys_exec_setmtime_script (const char *script_name, int dirfd,
+ const char *file_name, const char *fmt,
+ struct timespec *ts);
/* Module compare.c */
void report_difference (struct tar_stat_info *st, const char *message, ...)
paxfatal (0, _("Cannot use compressed or remote archives"));
}
-int
+bool
sys_exec_setmtime_script (const char *script_name,
int dirfd,
const char *file_name,
return pos < 0 ? -1 : ftruncate (fd, pos);
}
-/* Return nonzero if NAME is the name of a regular file, or if the file
+/* Return true if NAME is the name of a regular file, or if the file
does not exist (so it would be created as a regular file). */
-static int
+static bool
is_regular_file (const char *name)
{
struct stat stbuf;
if (stat (name, &stbuf) == 0)
- return S_ISREG (stbuf.st_mode);
+ return !!S_ISREG (stbuf.st_mode);
else
return errno == ENOENT;
}
static void (*pipe_handler) (int sig);
int
-sys_exec_command (char *file_name, int typechar, struct tar_stat_info *st)
+sys_exec_command (char *file_name, char typechar, struct tar_stat_info *st)
{
int p[2];
xexec (script_name);
}
-int
+bool
sys_exec_setmtime_script (const char *script_name,
int dirfd,
const char *file_name,
{
pid_t pid;
int p[2];
- int stop = 0;
+ bool stop = false;
struct pollfd pfd;
char *buffer = NULL;
idx_t buflen = 0;
idx_t bufsize = 0;
char *cp;
- int rc = 0;
+ bool rc = true;
if (pipe (p) < 0)
paxfatal (errno, _("pipe failed"));
if (errno != EINTR)
{
paxerror (errno, _("poll failed"));
- stop = 1;
+ stop = true;
break;
}
}
if (nread < 0)
{
paxerror (errno, _("error reading output of %s"), script_name);
- stop = 1;
+ stop = true;
break;
}
if (nread == 0)
if (stop)
{
free (buffer);
- return -1;
+ return false;
}
if (buflen == 0)
{
paxerror (0, _("empty output from \"%s %s\""), script_name, file_name);
- return -1;
+ return false;
}
cp = memchr (buffer, '\n', buflen);
paxerror (0, _("output from \"%s %s\" does not satisfy format string:"
" %s"),
script_name, file_name, buffer);
- rc = -1;
+ rc = false;
}
else if (*cp != 0)
{
paxwarn (0, _("unconsumed output from \"%s %s\": %s"),
script_name, file_name, cp);
- rc = -1;
+ rc = false;
}
else
{
if (tm.tm_wday < 0)
{
paxerror (errno, _("mktime failed"));
- rc = -1;
+ rc = false;
}
else
{
{
paxerror (0, _("unparsable output from \"%s %s\": %s"),
script_name, file_name, buffer);
- rc = -1;
+ rc = false;
}
free (buffer);