mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
s4-waf: use the libreplace strerror_r if needed
This commit is contained in:
parent
7ed349cace
commit
686221eae2
@ -748,10 +748,15 @@ char *rep_get_current_dir_name(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_STRERROR_R
|
#if !defined(HAVE_STRERROR_R) || !defined(STRERROR_R_PROTO_COMPATIBLE)
|
||||||
char *rep_strerror_r(int errnum, char *buf, size_t buflen)
|
int rep_strerror_r(int errnum, char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
strncpy(buf, strerror(errnum), buflen);
|
char *s = strerror(errnum);
|
||||||
return buf;
|
if (strlen(s)+1 > buflen) {
|
||||||
|
errno = ERANGE;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
strncpy(buf, s, buflen);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -512,9 +512,9 @@ ssize_t rep_pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset)
|
|||||||
char *rep_get_current_dir_name(void);
|
char *rep_get_current_dir_name(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_STRERROR_R
|
#if !defined(HAVE_STRERROR_R) || !defined(STRERROR_R_PROTO_COMPATIBLE)
|
||||||
#define strerror_r rep_strerror_r
|
#define strerror_r rep_strerror_r
|
||||||
char *rep_strerror_r(int errnum, char *buf, size_t buflen);
|
int rep_strerror_r(int errnum, char *buf, size_t buflen);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIMITS_H
|
#ifdef HAVE_LIMITS_H
|
||||||
|
@ -640,7 +640,6 @@ HEIMDAL_ROKEN_OBJ_FILES = \
|
|||||||
$(heimdalsrcdir)/lib/roken/erealloc.o \
|
$(heimdalsrcdir)/lib/roken/erealloc.o \
|
||||||
$(heimdalsrcdir)/lib/roken/simple_exec.o \
|
$(heimdalsrcdir)/lib/roken/simple_exec.o \
|
||||||
$(heimdalsrcdir)/lib/roken/strcollect.o \
|
$(heimdalsrcdir)/lib/roken/strcollect.o \
|
||||||
$(heimdalsrcdir)/lib/roken/strerror_r.o \
|
|
||||||
$(heimdalsrcdir)/lib/roken/rtbl.o \
|
$(heimdalsrcdir)/lib/roken/rtbl.o \
|
||||||
$(heimdalsrcdir)/lib/roken/cloexec.o \
|
$(heimdalsrcdir)/lib/roken/cloexec.o \
|
||||||
$(heimdalsrcdir)/lib/roken/xfree.o \
|
$(heimdalsrcdir)/lib/roken/xfree.o \
|
||||||
|
@ -111,6 +111,15 @@
|
|||||||
#define HAVE_GETTIMEOFDAY
|
#define HAVE_GETTIMEOFDAY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* force the use of the libreplace strerror_r */
|
||||||
|
#ifndef HAVE_STRERROR_R
|
||||||
|
#define HAVE_STRERROR_R
|
||||||
|
#endif
|
||||||
|
#ifndef STRERROR_R_PROTO_COMPATIBLE
|
||||||
|
#define STRERROR_R_PROTO_COMPATIBLE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* we lie about having pidfile() so that NetBSD5 can compile. Nothing
|
/* we lie about having pidfile() so that NetBSD5 can compile. Nothing
|
||||||
in the parts of heimdal we use actually uses pidfile(), and we
|
in the parts of heimdal we use actually uses pidfile(), and we
|
||||||
don't use it in Samba, so this works, although its ugly */
|
don't use it in Samba, so this works, although its ugly */
|
||||||
|
Loading…
Reference in New Issue
Block a user