Skip to content

Commit 620a836

Browse files
authored
Merge pull request #1115 from redhatrises/update_os_defined
Update OS_defines to use oscap_platforms.h
2 parents b84c4fc + 94ef379 commit 620a836

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+183
-164
lines changed

compat/compat.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#define OSCAP_COMPAT_H_
2525

2626
#include "oscap_export.h"
27+
#include "oscap_platforms.h"
2728

2829
/* Fallback functions fixing portability issues */
2930

@@ -40,7 +41,7 @@ char *strptime(const char *buf, const char *format, struct tm *tm);
4041
#define OSCAP_UNIX
4142
#endif
4243

43-
#ifdef _WIN32
44+
#ifdef OS_WINDOWS
4445
#define PATH_MAX _MAX_PATH
4546
#endif
4647

compat/oscap_platforms.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@
3232

3333
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
3434
# define OS_FREEBSD
35-
#elif defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)
35+
#elif defined(__linux__) && defined(__GLIBC__)
36+
# define OS_LINUX_WITH_GLIBC
37+
#elif defined(__linux__) || defined(OS_LINUX_WITH_GLIBC)
3638
# define OS_LINUX
3739
#elif defined(sun) || defined(__sun)
40+
# define OS_SUN
3841
# if defined(__SVR4) || defined(__svr4__)
3942
# define OS_SOLARIS
4043
# else
@@ -46,9 +49,11 @@
4649
# define OS_AIX
4750
#elif defined(__APPLE__)
4851
# define OS_APPLE
49-
# if defined(Macintosh) || defined(macintosh) || defined(__APPLE__) && defined(__MACH__)
52+
# if defined(Macintosh) || defined(macintosh) || defined(__MACH__) || defined(__APPLE__)
5053
# define OS_OSX
5154
# endif
55+
#elif defined(_hpux) || defined(hpux) || defined(__hpux)
56+
# define OS_HPUX
5257
#else
5358
# error "Sorry, your OS isn't supported."
5459
#endif

src/CVSS/cvss.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
*
6060
* raising a "Initializer must be a valid constant expression" compiler error.
6161
*/
62-
#if defined(_AIX)
62+
#if defined(OS_AIX)
6363
#define NAN_INIT (0.0f/0.0f)
6464

6565
#else /* Platforms with non broken NAN */

src/DS/sds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
#include <string.h>
5757
#include <fcntl.h>
58-
#ifdef _WIN32
58+
#ifdef OS_WINDOWS
5959
#include <io.h>
6060
#else
6161
#include <unistd.h>
@@ -187,7 +187,7 @@ static int ds_sds_dump_component_sce(const xmlNode *script_node, const char *com
187187
}
188188
// TODO: error checking, fprintf should return strlen((const char*)text_contents)
189189
fprintf(output_file, "%s", text_contents ? (char*)text_contents : "");
190-
#ifndef _WIN32
190+
#ifndef OS_WINDOWS
191191
// NB: This code is for SCE scripts
192192
if (fchmod(fd, 0700) != 0) {
193193
oscap_seterr(OSCAP_EFAMILY_XML, "Failed to set executable permission on script (id='%s') that was split to '%s'.", component_id, filename);

src/OVAL/fts_sun.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2727
* SUCH DAMAGE.
2828
*/
29-
#if defined (__SVR4) && defined (__sun)
29+
#if defined (OS_SOLARIS)
3030

3131
#include <config.h>
3232

@@ -57,7 +57,7 @@ static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94";
5757
#define ALIGN(p) (((unsigned long int) (p) + ALIGNBYTES) & ~ALIGNBYTES)
5858
#endif
5959

60-
#if defined (__SVR4)
60+
#if defined (OS_SOLARIS)
6161
#define USHRT_MAX 65535 /* max of "unsigned short int" */
6262
#define __set_errno(val) (errno = (val))
6363
#define __fchdir fchdir
@@ -1023,7 +1023,7 @@ fts_alloc(sp, name, namelen)
10231023
p->fts_instr = FTS_NOINSTR;
10241024
p->fts_number = 0;
10251025
p->fts_pointer = NULL;
1026-
#if defined(__SVR4) && defined(__sun)
1026+
#if defined(OS_SOLARIS)
10271027
if (!ISSET(FTS_NOSTAT))
10281028
p->fts_statp->st_fstype[0] = '\0';
10291029
#endif

src/OVAL/fts_sun.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,14 @@
5050
# define __END_DECLS
5151
#endif
5252

53-
#if defined(hpux)
53+
#if defined(OS_HPUX)
5454
# define _D_EXACT_NAMLEN(d) ((d)->d_namlen)
5555
# define _INCLUDE_POSIX_SOURCE
5656
# define _LARGEFILE64_SOURCE
5757
#endif
5858

5959
/* This needs to be ifdef SOLARIS */
60-
#if defined(__SVR4)
60+
#if defined(OS_SOLARIS)
6161
# define _D_EXACT_NAMLEN(d) (strlen((d)->d_name))
6262
# ifndef _INCLUDE_POSIX_SOURCE
6363
# define _INCLUDE_POSIX_SOURCE
@@ -249,8 +249,8 @@ __END_DECLS
249249

250250
#endif /* fts.h */
251251
#else
252-
#if defined(__SVR4) && defined(__sun)
252+
#if defined(OS_SOLARIS)
253253
#include <fts.h>
254-
#endif /* defined(__SVR4) && defined(__sun) */
254+
#endif /* defined(OS_SOLARIS) */
255255

256256
#endif /* HAVE_FTS_OPEN */

src/OVAL/oval_generator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include <stdlib.h>
3535
#include <time.h>
3636

37-
#ifndef _WIN32
37+
#ifndef OS_WINDOWS
3838
#include <sys/time.h>
3939
#endif
4040

src/OVAL/oval_probe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#include "oval_probe_ext.h"
4949
#include "collectVarRefs_impl.h"
5050

51-
#ifdef _WIN32
51+
#ifdef OS_WINDOWS
5252
#define X_OK 0
5353
#endif
5454

src/OVAL/oval_probe_ext.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include <limits.h>
3131
#include <sys/types.h>
3232
#include <sys/stat.h>
33-
#ifdef _WIN32
33+
#ifdef OS_WINDOWS
3434
#include <io.h>
3535
#else
3636
#include <unistd.h>
@@ -1021,7 +1021,7 @@ int oval_probe_ext_reset(SEAP_CTX_t *ctx, oval_pd_t *pd, oval_pext_t *pext)
10211021
#include "SEAP/_seap-types.h"
10221022
#include "SEAP/seap-descriptor.h"
10231023

1024-
#ifdef _WIN32
1024+
#ifdef OS_WINDOWS
10251025

10261026
int oval_probe_ext_abort(SEAP_CTX_t *ctx, oval_pd_t *pd, oval_pext_t *pext)
10271027
{

src/OVAL/oval_session.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
#include <config.h>
2525
#endif
2626

27-
#ifdef _WIN32
27+
#ifdef OS_WINDOWS
2828
#include <io.h>
2929
#else
3030
#include <unistd.h>
3131
#endif
3232
#include <string.h>
33-
#if defined(__linux__)
33+
#if defined(OS_LINUX)
3434
#include <linux/limits.h>
3535
#endif
3636

0 commit comments

Comments
 (0)