Note that we may call this function in signal handle 'sigShutdownHandler', * so we need guarantee all functions we call are async-signal-safe. * If we call this function from signal handle, we won't call bg_unlik that * is not async-signal-safe. */
| 1725 | * If we call this function from signal handle, we won't call bg_unlik that |
| 1726 | * is not async-signal-safe. */ |
| 1727 | void rdbRemoveTempFile(int tmpfileNum, int from_signal) { |
| 1728 | char tmpfile[256]; |
| 1729 | |
| 1730 | getTempFileName(tmpfile, tmpfileNum); |
| 1731 | |
| 1732 | if (from_signal) { |
| 1733 | /* bg_unlink is not async-signal-safe, but in this case we don't really |
| 1734 | * need to close the fd, it'll be released when the process exists. */ |
| 1735 | int fd = open(tmpfile, O_RDONLY|O_NONBLOCK); |
| 1736 | UNUSED(fd); |
| 1737 | unlink(tmpfile); |
| 1738 | } else { |
| 1739 | bg_unlink(tmpfile); |
| 1740 | } |
| 1741 | } |
| 1742 | |
| 1743 | /* This function is called by rdbLoadObject() when the code is in RDB-check |
| 1744 | * mode and we find a module value of type 2 that can be parsed without |
no test coverage detected