qrexec-lib: add glibc version test check for having syncfs
Compile fix for wheezy, which has too old glibc (2.13).
This commit is contained in:
parent
931944f118
commit
c2c36d9c09
@ -33,6 +33,10 @@ void send_status_and_crc(int code, const char *last_filename);
|
|||||||
#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT)
|
#define O_TMPFILE_MASK (__O_TMPFILE | O_DIRECTORY | O_CREAT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 14)
|
||||||
|
#define HAVE_SYNCFS
|
||||||
|
#endif
|
||||||
|
|
||||||
void do_exit(int code, const char *last_filename)
|
void do_exit(int code, const char *last_filename)
|
||||||
{
|
{
|
||||||
close(0);
|
close(0);
|
||||||
@ -208,8 +212,10 @@ void process_one_file(struct file_header *untrusted_hdr)
|
|||||||
int do_unpack(void)
|
int do_unpack(void)
|
||||||
{
|
{
|
||||||
struct file_header untrusted_hdr;
|
struct file_header untrusted_hdr;
|
||||||
|
#ifdef HAVE_SYNCFS
|
||||||
int cwd_fd;
|
int cwd_fd;
|
||||||
int saved_errno;
|
int saved_errno;
|
||||||
|
#endif
|
||||||
|
|
||||||
total_bytes = total_files = 0;
|
total_bytes = total_files = 0;
|
||||||
/* initialize checksum */
|
/* initialize checksum */
|
||||||
@ -226,10 +232,12 @@ int do_unpack(void)
|
|||||||
process_one_file(&untrusted_hdr);
|
process_one_file(&untrusted_hdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_SYNCFS
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
cwd_fd = open(".", O_RDONLY);
|
cwd_fd = open(".", O_RDONLY);
|
||||||
if (cwd_fd >= 0 && syncfs(cwd_fd) == 0 && close(cwd_fd) == 0)
|
if (cwd_fd >= 0 && syncfs(cwd_fd) == 0 && close(cwd_fd) == 0)
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
|
#endif
|
||||||
|
|
||||||
send_status_and_crc(errno, untrusted_namebuf);
|
send_status_and_crc(errno, untrusted_namebuf);
|
||||||
return errno;
|
return errno;
|
||||||
|
Loading…
Reference in New Issue
Block a user