Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/iodbc.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,15 @@
#if !defined(WINDOWS) && !defined(WIN32_SYSTEM)
#define _UNIX_

#ifndef _POSIX_C_SOURCE
/* POSIX.1-2008 is required for strdup() */
#define _POSIX_C_SOURCE 200809L
#endif

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#else error out if _POSIX_C_SOURCE < 200809L?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It already errors, that's how I noticed :)

It would be nice to show the error as early as possible, but there's a small risk of breaking things for people with other C libraries. Clearly it works on glibc without the define, otherwise everyone would have noticed. But does it work on glibc with some earlier constant defined? (I don't know). If it does, then turning that into an error would probably be bad, even though anyone defining _POSIX_C_SOURCE to something less than 2008 has asked for it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I meant an earlier/more explicit error.

I'm on the side of 'fail fast', so I would welcome such 'breakage', but I know not everyone agrees


#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <sys/types.h>

#define MEM_ALLOC(size) (malloc((size_t)(size)))
Expand Down
1 change: 1 addition & 0 deletions iodbc/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
#include <sqlucode.h>
#include <iodbcext.h>
#include <odbcinst.h>
#include <time.h>

#include "dlproc.h"

Expand Down