Do not try to copy non-regular files of unknown type

This commit is contained in:
Pierre Pronchery 2018-01-30 01:22:51 +01:00
parent 172980bdb7
commit 6333c9f3d8

View File

@ -398,13 +398,18 @@ static int _copy_single(Copy * copy, char const * src, char const * dst)
ret = _single_nod(copy, src, dst, st.st_mode, st.st_rdev); ret = _single_nod(copy, src, dst, st.st_mode, st.st_rdev);
else if(S_ISLNK(st.st_mode)) else if(S_ISLNK(st.st_mode))
ret = _single_symlink(copy, src, dst); ret = _single_symlink(copy, src, dst);
else else if(S_ISREG(st.st_mode))
{ {
ret = _single_regular(copy, src, dst, st.st_mode & 0777); ret = _single_regular(copy, src, dst, st.st_mode & 0777);
timeout = g_timeout_add(250, _single_timeout, copy); timeout = g_timeout_add(250, _single_timeout, copy);
gtk_main(); /* XXX ugly */ gtk_main(); /* XXX ugly */
g_source_remove(timeout); g_source_remove(timeout);
} }
else
{
errno = ENOSYS;
return _copy_error(copy, src, 1);
}
if(ret != 0) if(ret != 0)
return ret; return ret;
if(*(copy->prefs) & PREFS_p) /* XXX TOCTOU */ if(*(copy->prefs) & PREFS_p) /* XXX TOCTOU */