Comments (6)
This is a known issue, I recently got access to a Linux distro with a musl based libc which lacks res_randomid(), this will be worked out in a very near future.
from libasr.
I googled and found glibc's implementation:
u_int
res_randomid(void) {
return 0xffff & __getpid();
}
and they call it random???
Good news is that it should be trivial to fix.
from libasr.
Quick and dirty hack. We probably want something better though.
diff --git a/configure.ac b/configure.ac
index 10aff04..07e149f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -456,6 +456,7 @@ AC_CHECK_FUNCS([ \
issetugid \
memmove \
reallocarray \
+ res_randomid \
snprintf \
strdup \
strerror \
diff --git a/src/asr_private.h b/src/asr_private.h
index 0960e37..254e83e 100644
--- a/src/asr_private.h
+++ b/src/asr_private.h
@@ -365,3 +365,7 @@ extern FILE * asr_debug;
asr_statestr((a)->as_state), \
asr_statestr((s))); \
(a)->as_state = (s); } while (0)
+
+#ifndef HAVE_RES_RANDOMID
+#define res_randomid(x) (0xfff & getpid())
+#endif
from libasr.
neither @ericfaurot or I feel comfortable with mimic-ing the glibc dumb res_randomid()
with a little bit of work, we should be able to bring an arc4random()-based one relying on the arc4random() from the portable layer.
from libasr.
That was what I wanted to hear. Thanks!
from libasr.
this has been opened for way too long, I've merged a diff very similar to yours, eric can improve further when he gets a better idea.
thanks !
from libasr.
Related Issues (11)
- patch: automake subdir-objects HOT 4
- Incorrect compat definition of NETDB_SUCCESS HOT 1
- Build fails on Slackware 14.2 HOT 3
- New release HOT 2
- libasr 1.0.3 lacks an explicit_bzero replacement function if it's missing HOT 3
- 1.0.4: gcc 10 comile time warnings HOT 6
- Using AI_CANONNAME on systems that do not defined AI_FQDN causes BADFLAGS error HOT 4
- Off-by-one if the file ends without a newline HOT 1
- check MANTYPE use wrong file HOT 1
- build error on OS X: conflicting types for 'snprintf' HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libasr.