Make seed collection parts that depend on particular functions

#ifdef'd on that to enable easier windows/mingw32 porting.




git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13525 57a11ea4-9604-0410-9ed3-97b8803252fd
zzzoldfeatures/register-rewrite
Christian Stimming 20 years ago
parent 96dea8f6b7
commit 3006050069

@ -1,5 +1,12 @@
2006-03-07 Christian Stimming <stimming@tuhh.de>
* lib/libqof/qof/guid.c: Make seed collection parts that depend on
particular functions #ifdef'd on that to enable easier
windows/mingw32 porting.
* lib/libc/setenv.h: Fix old libc substitution files, now needed
for windows/mingw32 porting.
* Makefile.am: Add po/gnucash.pot to EXTRA_DIST because the
translation template is needed in the tarball for translators.

@ -114,6 +114,9 @@ if test "x$ac_cv_header_ltdl_h" = xno; then
AC_MSG_ERROR([Cannot find ltdl.h -- libtool-devel (or libtool-ltdl-devel) not installed?])
fi
# These are unavailable on windows/mingw32
AC_CHECK_FUNCS(getppid getuid gethostname gmtime_r)
### --------------------------------------------------------------------------
### See if we have pkg-config

@ -27,7 +27,9 @@
# include <config.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <ctype.h>
#include <dirent.h>
#include <glib.h>
@ -35,7 +37,9 @@
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/times.h>
#ifdef HAVE_TIMES
# include <sys/times.h>
#endif
#include <time.h>
#include <unistd.h>
#include "qof.h"
@ -285,7 +289,9 @@ init_from_time(void)
size_t total;
time_t t_time;
clock_t clocks;
#ifdef HAVE_TIMES
struct tms tms_buf;
#endif
total = 0;
@ -293,10 +299,12 @@ init_from_time(void)
md5_process_bytes(&t_time, sizeof(t_time), &guid_context);
total += sizeof(t_time);
#ifdef HAVE_TIMES
clocks = times(&tms_buf);
md5_process_bytes(&clocks, sizeof(clocks), &guid_context);
md5_process_bytes(&tms_buf, sizeof(tms_buf), &guid_context);
total += sizeof(clocks) + sizeof(tms_buf);
#endif
return total;
}
@ -380,13 +388,16 @@ guid_init(void)
md5_process_bytes(&pid, sizeof(pid), &guid_context);
bytes += sizeof(pid);
#ifdef HAVE_GETPPID
pid = getppid();
md5_process_bytes(&pid, sizeof(pid), &guid_context);
bytes += sizeof(pid);
#endif
}
/* user info */
{
#ifdef HAVE_GETUID
uid_t uid;
gid_t gid;
char *s;
@ -405,16 +416,19 @@ guid_init(void)
gid = getgid();
md5_process_bytes(&gid, sizeof(gid), &guid_context);
bytes += sizeof(gid);
#endif
}
/* host info */
{
#ifdef HAVE_GETHOSTNAME
char string[1024];
memset(string, 0, sizeof(string));
gethostname(string, sizeof(string));
md5_process_bytes(string, sizeof(string), &guid_context);
bytes += sizeof(string);
#endif
}
/* plain old random */

Loading…
Cancel
Save