sync code with last improvements from OpenBSD
This commit is contained in:
parent
e1ec829e63
commit
68fa196282
30 changed files with 268 additions and 1060 deletions
|
@ -32,6 +32,12 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
/* g_pattern_spec_match_string is available in glib 2.70 and later,
|
||||
to replace the deprecated g_pattern_match_string */
|
||||
#ifdef HAVE_G_PATTERN_SPEC_MATCH_STRING
|
||||
#define g_pattern_match_string g_pattern_spec_match_string
|
||||
#endif
|
||||
|
||||
#define DEFAULT_TIMEOUT 10 /* maximum seconds for each file */
|
||||
|
||||
static sigjmp_buf jump_env;
|
||||
|
|
|
@ -33,6 +33,10 @@
|
|||
|
||||
#include "TestAllFiles.h"
|
||||
|
||||
#ifndef O_CLOEXEC
|
||||
# define O_CLOEXEC 0
|
||||
#endif
|
||||
|
||||
#ifndef g_assert_no_errno /* defined in glib 2.66 & later */
|
||||
#define g_assert_no_errno(n) g_assert_cmpint(n, >=, 0)
|
||||
#endif
|
||||
|
@ -147,7 +151,7 @@ TestReadFileToBuffer(const gchar *filepath)
|
|||
g_assert_nonnull(buffer);
|
||||
|
||||
/* Read file ourselves and verify the data matches */
|
||||
g_assert_no_errno(fd = open(filepath, O_RDONLY));
|
||||
g_assert_no_errno(fd = open(filepath, O_RDONLY | O_CLOEXEC));
|
||||
while ((rd = read(fd, readbuf, sizeof(readbuf))) > 0) {
|
||||
g_assert_cmpmem(b, rd, readbuf, rd);
|
||||
b += rd;
|
||||
|
|
|
@ -38,6 +38,10 @@
|
|||
#include "TestAllFiles.h"
|
||||
#include "CompareXpmImage.h"
|
||||
|
||||
#ifndef O_CLOEXEC
|
||||
# define O_CLOEXEC 0
|
||||
#endif
|
||||
|
||||
#ifndef g_assert_no_errno /* defined in glib 2.66 & later */
|
||||
#define g_assert_no_errno(n) g_assert_cmpint(n, >=, 0)
|
||||
#endif
|
||||
|
@ -295,7 +299,7 @@ TestWriteFileFromBuffer(const gchar *filepath)
|
|||
ssize_t rd;
|
||||
|
||||
/* Read file ourselves and verify the data matches */
|
||||
g_assert_no_errno(fd = open(newfilepath, O_RDONLY));
|
||||
g_assert_no_errno(fd = open(newfilepath, O_RDONLY | O_CLOEXEC));
|
||||
while ((rd = read(fd, readbuf, sizeof(readbuf))) > 0) {
|
||||
g_assert_cmpmem(b, rd, readbuf, rd);
|
||||
b += rd;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#include "../src/XpmI.h"
|
||||
#include "../src/rgb.c"
|
||||
#include <glib.h>
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue