Commit
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,7 +94,7 @@ bin2hex(char *dst, size_t dstlen, const uint8_t *src, size_t srclen) | |
| void | ||
| uuid_init ( void ) | ||
| { | ||
| fd = open(RANDOM_PATH, O_RDONLY); | ||
| fd = open(RANDOM_PATH, O_RDONLY|O_CLOEXEC); | ||
This comment has been minimized.
Sorry, something went wrong.
nurtext
|
||
| if (fd == -1) { | ||
| tvherror("uuid", "failed to open %s", RANDOM_PATH); | ||
| exit(1); | ||
|
|
||
3 comments
on commit 2cee0bf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is another workaround for this, which is how the original TVH code works. Which is to use the tvh_open() wrapper to set the CLOEXEC flag using fcntl().
Setting CLOEXEC by default is good practice, since it removes the potentially for accidentally leaking access to potentially important resources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed the issue in uuid.c using tvh_open - 36a06a6 , but for rest, I would just add #ifdefs , Note that I figured that some linked libraries do not care (avahi, dbus, hdhomerun), so there is
for (f = 3; f < maxfd; f++)
close(f);
loop in the spawn/exec routines now..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@perexg @ProfYaffle Thanks for fixing the CLOEXEC issue! I still get another CC error when trying to cross-compile for Synology. For more details see my following comment: 2cee0bf#commitcomment-8759211
If I'm experienced enough in C/C++ I would fix it by myself, but unfortunatly I'm not 😞
Same here like my comment for CLOEXEC. Cross compilation fails.
Any chance for getting a new patch like in 36a06a6 @perexg?