diff options
author | jbj <jbj> | 2008-10-25 19:02:58 +0000 |
---|---|---|
committer | jbj <jbj> | 2008-10-25 19:02:58 +0000 |
commit | b9b46dd9df4bd80d108da00ac29d8fd876e6200d (patch) | |
tree | 130b93db4bfe273934502b81803171837aa74915 /popt.c | |
parent | 4ff155de92358ba7f41e50eec7008d8d6d81accb (diff) | |
download | libpopt-b9b46dd9df4bd80d108da00ac29d8fd876e6200d.tar.gz |
- test/use HAVE_SRANDOM to avoid portability issues.
Diffstat (limited to 'popt.c')
-rw-r--r-- | popt.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -739,12 +739,17 @@ int poptSaveLongLong(long long * arg, unsigned int argInfo, long long aLongLong) return POPT_ERROR_NULLARG; if (aLongLong != 0 && LF_ISSET(RANDOM)) { +#if defined(HAVE_SRANDOM) if (!seed) { srandom((unsigned)getpid()); srandom((unsigned)random()); } aLongLong = (long long)(random() % (aLongLong > 0 ? aLongLong : -aLongLong)); aLongLong++; +#else + /* XXX avoid adding POPT_ERROR_UNIMPLEMENTED to minimize i18n churn. */ + return POPT_ERROR_BADOPERATION; +#endif } if (LF_ISSET(NOT)) aLongLong = ~aLongLong; @@ -775,12 +780,17 @@ int poptSaveLong(long * arg, unsigned int argInfo, long aLong) return POPT_ERROR_NULLARG; if (aLong != 0 && LF_ISSET(RANDOM)) { +#if defined(HAVE_SRANDOM) if (!seed) { srandom((unsigned)getpid()); srandom((unsigned)random()); } aLong = random() % (aLong > 0 ? aLong : -aLong); aLong++; +#else + /* XXX avoid adding POPT_ERROR_UNIMPLEMENTED to minimize i18n churn. */ + return POPT_ERROR_BADOPERATION; +#endif } if (LF_ISSET(NOT)) aLong = ~aLong; @@ -811,12 +821,17 @@ int poptSaveInt(/*@null@*/ int * arg, unsigned int argInfo, long aLong) return POPT_ERROR_NULLARG; if (aLong != 0 && LF_ISSET(RANDOM)) { +#if defined(HAVE_SRANDOM) if (!seed) { srandom((unsigned)getpid()); srandom((unsigned)random()); } aLong = random() % (aLong > 0 ? aLong : -aLong); aLong++; +#else + /* XXX avoid adding POPT_ERROR_UNIMPLEMENTED to minimize i18n churn. */ + return POPT_ERROR_BADOPERATION; +#endif } if (LF_ISSET(NOT)) aLong = ~aLong; |