summaryrefslogtreecommitdiff
path: root/lib/replace/replace.c
AgeCommit message (Collapse)AuthorFilesLines
2019-09-01Spelling fixes s/convertion/conversion/Mathieu Parent1-2/+2
Signed-off-by: Mathieu Parent <math.parent@gmail.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2018-11-13replace: Add check for variable program_invocation_short_nameMartin Schwenke1-5/+5
It appears that wafsamba's configure() defines _GNU_SOURCE unconditionally, so checking _GNU_SOURCE isn't enough to know if this variable is available. For example, it isn't available on AIX with the xlc compiler: [ 6/10] Compiling lib/replace/replace.c ... "../../lib/replace/replace.c", line 991.16: 1506-045 (S) Undeclared identifier program_invocation_short_name. Instead, add a configure check for program_invocation_short_name and use it. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Tue Nov 13 11:11:11 CET 2018 on sn-devel-144
2018-11-13lib:replace: Do not leak the file pointer in rep_getprogname()Andreas Schneider1-5/+12
And return NULL on error. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2018-11-12lib:replace: Add getprogname()Andreas Schneider1-0/+71
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2018-10-16replace: Add memset_s() if not availableAndreas Schneider1-0/+31
See https://en.cppreference.com/w/c/string/byte/memset Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2017-09-26s4:smbd: call setproctitle_initGary Lockyer1-0/+5
Call setproctitle_init() in main which suppresses the "samba: setproctitle not initialized, please either call setproctitle_init() or link against libbsd-ctor." messages, but more importantly it displays meaningful details in ps output. BUG: https://bugzilla.samba.org/show_bug.cgi?id=9816 Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2017-06-13strerror_r: provide XSI-compliant strerror_rGary Lockyer1-0/+18
Provide a XSI-compliant strerror_r on GNU based systems. The default GNU strerror_r is not XSI-compliant, this patch wraps the GNU-specific call in an XSI-compliant wrapper. This reverts 18ed32ce0821d11c0c06d82c07ba1c27b0c2b886 which tried to make Heimdal use roken, rather than libreplace for strerror_r. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2015-10-31lib/replace: Make sure that replacement strto[u]ll does not reset errno ↵Felix Janda1-2/+4
unexpectedly Fix the replacement functions for strtoll and strtoull to not set errno to 0 if errno is EINVAL before calling, strto[u]ll does not modify errno and the base is ok. Bug: https://bugzilla.samba.org/show_bug.cgi?id=11455 Signed-off-by: Felix Janda <felix.janda@posteo.de> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-10-31lib/replace: Replace BSD strtoull by wrapping strtoull instead of strtouqFelix Janda1-6/+3
Same as commit e50bf6d537ef09e936d19d6e0bf63f9bbc5d4818 but for strtoull instead of strtoll. Bug: https://bugzilla.samba.org/show_bug.cgi?id=11455 Signed-off-by: Felix Janda <felix.janda@posteo.de> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-10-01libreplace: Fix the build on SolarisVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2015-08-19replace: Fix bug 11455Volker Lendecke1-0/+1
Don't call rep_strtoull recursively Bug: https://bugzilla.samba.org/show_bug.cgi?id=11455 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Wed Aug 19 11:22:38 CEST 2015 on sn-devel-104
2015-07-29lib: replace: Add strsep function (missing on Solaris).Jeremy Allison1-0/+20
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11359 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ira Cooper <ira@wakeful.net> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Jul 29 02:24:55 CEST 2015 on sn-devel-104
2015-06-22replace: Replace BSD strtoll by wrapping strtoll instead of strtoqFelix Janda1-6/+2
When it is detected that strtoll returns EINVAL not only in the case that the base is not supported, HAVE_BSD_STRTOLL is declared and strtoll is replaced. The current replacement code wraps strtoq in order to replace strtoll and errors out when strtoq is missing. In order to remove this possible error path, we can use strtoll instead of strtoq since the code is only used when it is known that strtoll exists. The fixes a compilation problem on linux systems using musl libc, which has a BSD-like strtoll but no strtoq. Signed-off-by: Felix Janda <felix.janda@posteo.de> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: "Stefan (metze) Metzmacher" <metze@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Jun 22 12:49:10 CEST 2015 on sn-devel-104
2015-03-26replace: clean-up strlcpy and add note on return valueDavid Disseldorp1-4/+12
The existing implementation uses single line ifs, making the code hard to visually parse. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2013-11-28replace: fix typo in variable nameDavid Disseldorp1-1/+1
13550a2b5eed57084a5d9671d9493a9a2e08d7e3 added a typo causing compilation failure. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): David Disseldorp <ddiss@samba.org> Autobuild-Date(master): Thu Nov 28 18:16:27 CET 2013 on sn-devel-104
2013-11-28replace: Don't run over dst in strlcatVolker Lendecke1-1/+1
If "d" is not 0-terminated, the pure strlen will read beyond the end of the given bufsize. strlcat in libbsd deliberately avoids this, so we should do the same. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-01-19heimdal_build: Try again to sort out the strerror_r messAndrew Bartlett1-1/+1
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-01-09replace: Fix compilation of rep_mkstempJesper Larsen1-1/+1
Commit 1fbc185 removed the variable 'p'. Use the equivalent variable 'template' instead. Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Jan 9 07:18:33 CET 2013 on sn-devel-104
2012-11-22lib/replace: Do not use STRERROR_R_PROTO_COMPATIBLE as only roken.h sets thisAndrew Bartlett1-1/+1
Currently, we put strerror_r into libreplace even on systems with strerror_r. Andrew Bartlett Reviewed-by: Andreas Schneider <asn@samba.org>
2012-11-14lib/replace: replace all *printf function if we replace snprintf (bug #9390)Stefan Metzmacher1-2/+2
This fixes segfaults in log level = 10 on Solaris. Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Björn Jacke <bj@sernet.de> Autobuild-User(master): Björn Jacke <bj@sernet.de> Autobuild-Date(master): Wed Nov 14 19:41:14 CET 2012 on sn-devel-104
2012-09-25replace: Avoid returning value in void setproctitle() replacement.Jelmer Vernooij1-1/+0
Autobuild-User(master): Jelmer Vernooij <jelmer@samba.org> Autobuild-Date(master): Tue Sep 25 06:38:40 CEST 2012 on sn-devel-104
2012-09-24replace: Support setproctitle().Jelmer Vernooij1-0/+7
This uses the setproctitle() from libc, libsetproctitle or libbsd. If none is available it provides a dummy implementation.
2012-09-23lib/replace: Remove unused nap and therefore the SCO defineAndrew Bartlett1-10/+0
In any case, the Samba Team stopped supporting SCO systems a long time ago. Andrew Bartlett
2012-04-26replace: Fix use of mktempSimo Sorce1-2/+2
mktemp always returns the template, so checking for NULL doesn't cactch any error. Errors are reported by turning the template into an empty string. Autobuild-User: Simo Sorce <idra@samba.org> Autobuild-Date: Thu Apr 26 16:14:24 CEST 2012 on sn-devel-104
2012-03-25replace: Avoid DEBUG(), which is not available in libreplace.Jelmer Vernooij1-1/+1
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sun Mar 25 00:13:59 CET 2012 on sn-devel-104
2012-03-24libreplace: Add usleep implementation.Jelmer Vernooij1-0/+14
2012-03-24replace: Work around socket wrapper.Jelmer Vernooij1-0/+1
It's fine to ignore socket wrapper here, as it doesn't deal with unix domain sockets.
2012-03-24replace: Add system/network.h for ucred struct.Jelmer Vernooij1-0/+1
2012-03-24libreplace: Add getpeereid implementation.Jelmer Vernooij1-0/+28
2012-03-24replace: Move memalign() from lib/util/system.c to libreplace.Jelmer Vernooij1-0/+32
2010-10-23lib/replace: fix rep_strtoull() prototypeStefan Metzmacher1-1/+1
metze
2010-10-22replace: use a wrapper around strtoll if it didn't behave as expectedMatthieu Patou1-2/+48
2010-09-10libreplace: clock_gettime sets errnoBjörn Jacke1-1/+2
2010-08-31libreplace: add clock_gettime replacement function for systems that don't ↵Björn Jacke1-0/+21
have it
2010-03-29s4-waf: use the libreplace strerror_r if neededAndrew Tridgell1-4/+9
2010-03-26libreplace: strerror_r() is needed by heimdal on solaris8Andrew Tridgell1-0/+8
2010-03-24libreplace: fixed declaration of dprintf() on FreeBSDAndrew Tridgell1-2/+2
2010-03-05replace: added get_current_dir_name()Andrew Tridgell1-0/+12
2010-02-22Spelling fixes for libreplace.Brad Hards1-1/+1
Signed-off-by: Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
2010-02-11libreplace: added replacements for dprintf() and vdprintf()Andrew Tridgell1-0/+31
these are very useful for writing files with formatted writes Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-01-23libreplace: Fix a C++ warningVolker Lendecke1-2/+2
2010-01-02libreplace: some systems don't have memmem()Andrew Tridgell1-0/+23
added rep_memmem() and a testsuite
2009-04-20Error out at runtime when seteuid/setresuid or setegid/setresgid are notJelmer Vernooij1-2/+4
available. This means it's possible to compile libreplace when these functions are not available and use it, as long as this particular function is not used.
2009-04-20Only define waitpid replacement if wait4 is available. (It isn't onJelmer Vernooij1-1/+1
Windows.)
2009-04-20Cope with the fact that only _mkdir() exists on Windows and that itJelmer Vernooij1-0/+4
doesn't take a mode argument.
2008-11-01Merge branch 'master' of /home/jelmer/samba3Jelmer Vernooij1-0/+52
Conflicts: lib/replace/README lib/replace/libreplace.m4 lib/replace/replace.c source3/include/proto.h source3/lib/system.c
2008-11-01Use dup2() replacement from libreplace.Jelmer Vernooij1-0/+9
2008-11-01Remove sys_chroot() - libreplace already provides an alternative.Jelmer Vernooij1-2/+0
2008-11-01Move sys_realpath() to libreplace.Jelmer Vernooij1-0/+11
2008-11-01Move sys_lchown() to libreplace.Jelmer Vernooij1-0/+8