Commit Graph

19 Commits

Author SHA1 Message Date
Ross Williams
7ed7014e14 Change getc return type from char to int32_t
The return type of `getc(3)` is a signed integer,
with negative values indicating an error. The changed
line stored the return value in an *unsigned* integer,
then tested it against a negative error constant, so
the error condition would never be detected. This
also results in a warning on GCC 10.

Further information:
- [`getc(3)`](https://man7.org/linux/man-pages/man3/fgetc.3.html)
- [C FAQ question 12.1](http://c-faq.com/stdio/getcharc.html)
2022-01-26 21:09:21 -05:00
Ross Williams
dc27bab518 Include poll.h instead of sys/poll.h
`poll.h` is the POSIX standard include location, and MUSL
libc issues a warning (which infnoise's `-Werror` in CFLAGS
makes into an error).

For more context:
- [Linux manpage for `poll(2)`][1]
- [Open Group UNIX Specification][2]
- [Relevant discussion over at the `emscripten` project][3]

[1]: https://man7.org/linux/man-pages/man2/poll.2.html
[2]: https://pubs.opengroup.org/onlinepubs/7908799/xsh/poll.h.html
[3]: https://github.com/emscripten-core/emscripten/issues/5447#issuecomment-321513332
2022-01-26 20:58:32 -05:00
Patrick Siegl
81973dff4f Merge branch 'master' of https://github.com/waywardgeek/infnoise into writeent 2019-03-28 00:15:52 +01:00
Patrick Siegl
fdfe30136d Wait until /dev/random is truly required 2019-03-28 00:13:14 +01:00
Patrick Siegl
84e2014fa5 Use the struct instead of multipe global vars. 2019-03-28 00:12:13 +01:00
Manuel Domke
095f2d1e6e Merge pull request #82 from psiegl/writeentropycleanup
Support any value from /proc instead of relying on buf.-size
2019-03-27 23:07:51 +01:00
Patrick Siegl
3cfcbd94d7 Feature: clean shutdown 2019-03-27 21:41:17 +01:00
Patrick Siegl
eb777add58 Support any value from /proc instead of relying on buf.-size 2019-03-27 21:35:29 +01:00
Manuel Domke
8bc29e04b1 update writeentropy.c 2018-04-21 17:22:37 +02:00
Manuel Domke
4a14cd7e82 clean up libinfnoise.h 2018-04-18 23:57:04 +02:00
Rune Magnussen
a98408c95e Always se long poll() timeout
Many init systems do their own backgrounding so use long timeout
unconditionally. Change suggested by Manuel Domke.
2018-01-04 16:51:48 +01:00
Rune Magnussen
2eebda163d Only force new entropy once a minute when backgrounded
Make the poll-timeout one minute if the option --daemon is used.
This saves a lot og CPU-time.
2017-12-01 16:18:29 +01:00
Rune Magnussen
54101c0de4 Introduce struct opt_struct for parsed options.
Parsed options are now placed in a structure which is passed as
argument to functions reduce the number of parameters. This makes
the call sites simpler. It also makes more informations available
to the functions.
2017-11-30 23:04:22 +01:00
Bill Cox
bfaa38b048 Updates from Rune Magnus 2016-06-29 08:28:37 -07:00
Bill Cox
dbc4dd0db9 Fixed compiler warnings - patch from Rune Magnussen 2015-08-10 07:54:54 -07:00
Bill Cox
5951fd00dd Added timer to insure I/O operations are fast enough for bit-bang 2014-11-08 10:35:48 -05:00
Bill Cox
97036593c7 update 2014-11-02 06:27:43 -05:00
Bill Cox
4e9814d33b update 2014-10-23 08:02:47 -04:00
Bill Cox
347adf3dc1 Added capability to write entropy to /dev/random 2014-10-22 16:49:08 -04:00