Since those are chunks of code based on our codebase, it's easiest to use the same license.
Replace this: if (fd >= 0) safe_close(fd); by this: safe_close(fd);