Various fixes needed for Solaris.
This commit is contained in:
parent
b2d5002ff1
commit
25a804c94e
4 changed files with 97 additions and 51 deletions
32
lib/dropin.c
32
lib/dropin.c
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: dropin.c,v 1.1.2.4 2001/02/06 10:12:51 guus Exp $
|
||||
$Id: dropin.c,v 1.1.2.5 2001/11/05 19:06:07 guus Exp $
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -27,6 +27,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <xalloc.h>
|
||||
|
||||
|
@ -136,3 +137,32 @@ char *get_current_dir_name(void)
|
|||
return buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ASPRINTF
|
||||
int asprintf(char **buf, const char *fmt, ...)
|
||||
{
|
||||
int status;
|
||||
va_list ap;
|
||||
int len;
|
||||
|
||||
len = 4096;
|
||||
*buf = xmalloc(len);
|
||||
|
||||
va_start(ap, fmt);
|
||||
status = vsnprintf (*buf, len, fmt, ap);
|
||||
va_end (ap);
|
||||
|
||||
if(status >= 0)
|
||||
*buf = xrealloc(*buf, status);
|
||||
|
||||
if(status > len-1)
|
||||
{
|
||||
len = status;
|
||||
va_start(ap, fmt);
|
||||
status = vsnprintf (*buf, len, fmt, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
$Id: dropin.h,v 1.1.2.3 2001/01/07 17:08:49 guus Exp $
|
||||
$Id: dropin.h,v 1.1.2.4 2001/11/05 19:06:07 guus Exp $
|
||||
*/
|
||||
|
||||
#ifndef __DROPIN_H__
|
||||
|
@ -31,4 +31,8 @@ extern int daemon(int, int);
|
|||
extern char* get_current_dir_name(void);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ASPRINTF
|
||||
extern int asprintf(char **, const char *, ...);
|
||||
#endif
|
||||
|
||||
#endif /* __DROPIN_H__ */
|
||||
|
|
30
lib/utils.c
30
lib/utils.c
|
@ -21,6 +21,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "config.h"
|
||||
|
@ -86,32 +87,3 @@ void cp_trace()
|
|||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ASPRINTF
|
||||
int asprintf(char **buf, const char *fmt, ...)
|
||||
{
|
||||
int status;
|
||||
va_list ap;
|
||||
int len;
|
||||
|
||||
len = 4096;
|
||||
*buf = xmalloc(len);
|
||||
|
||||
va_start(ap, fmt);
|
||||
status = vsnprintf (*buf, len, fmt, ap);
|
||||
va_end (ap);
|
||||
|
||||
if(status >= 0)
|
||||
*buf = xrealloc(*buf, status);
|
||||
|
||||
if(status > len-1)
|
||||
{
|
||||
len = status;
|
||||
va_start(ap, fmt);
|
||||
status = vsnprintf (*buf, len, fmt, ap);
|
||||
va_end (ap);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue