Pacify GCC in info_attach_exclist
* src/exclist.c (info_attach_exclist): Remove unnecessary test for whether dir and ex are null. GCC complains about the first one in some cases. Use C99-style decls.
This commit is contained in:
@@ -72,25 +72,21 @@ struct exclist
|
|||||||
void
|
void
|
||||||
info_attach_exclist (struct tar_stat_info *dir)
|
info_attach_exclist (struct tar_stat_info *dir)
|
||||||
{
|
{
|
||||||
struct excfile *file;
|
struct exclist *head = NULL, *tail = NULL;
|
||||||
struct exclist *head = NULL, *tail = NULL, *ent;
|
|
||||||
struct vcs_ignore_file *vcsfile;
|
|
||||||
|
|
||||||
if (dir->exclude_list)
|
if (dir->exclude_list)
|
||||||
return;
|
return;
|
||||||
for (file = excfile_head; file; file = file->next)
|
|
||||||
|
for (struct excfile *file = excfile_head; file; file = file->next)
|
||||||
{
|
{
|
||||||
if (faccessat (dir->fd, file->name, F_OK, 0) == 0)
|
if (faccessat (dir->fd, file->name, F_OK, 0) == 0)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
|
||||||
struct exclude *ex = NULL;
|
|
||||||
int fd = subfile_open (dir, file->name, O_RDONLY);
|
int fd = subfile_open (dir, file->name, O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
open_error (file->name);
|
open_error (file->name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fp = fdopen (fd, "r");
|
FILE *fp = fdopen (fd, "r");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
paxerror (errno, _("%s: fdopen failed"), file->name);
|
paxerror (errno, _("%s: fdopen failed"), file->name);
|
||||||
@@ -98,10 +94,9 @@ info_attach_exclist (struct tar_stat_info *dir)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ex)
|
struct exclude *ex = new_exclude ();
|
||||||
ex = new_exclude ();
|
|
||||||
|
|
||||||
vcsfile = get_vcs_ignore_file (file->name);
|
struct vcs_ignore_file *vcsfile = get_vcs_ignore_file (file->name);
|
||||||
|
|
||||||
if (vcsfile->initfn)
|
if (vcsfile->initfn)
|
||||||
vcsfile->data = vcsfile->initfn (vcsfile->data);
|
vcsfile->data = vcsfile->initfn (vcsfile->data);
|
||||||
@@ -113,7 +108,7 @@ info_attach_exclist (struct tar_stat_info *dir)
|
|||||||
paxfatal (errno, "%s", quotearg_colon (file->name));
|
paxfatal (errno, "%s", quotearg_colon (file->name));
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
|
||||||
ent = xmalloc (sizeof (*ent));
|
struct exclist *ent = xmalloc (sizeof *ent);
|
||||||
ent->excluded = ex;
|
ent->excluded = ex;
|
||||||
ent->flags = file->flags;
|
ent->flags = file->flags;
|
||||||
ent->prev = tail;
|
ent->prev = tail;
|
||||||
|
|||||||
Reference in New Issue
Block a user