Thanks for the review! > - Use the type size_t for tempdirlen as that is the return type of > strlen() and argument type for get_mem(). > > - You can use a const size_t variable for the length of the string > "slash" rather than calling strlen() in the do-while loop.
Both OK. > - Don't set errno as we anyway loop until we successfully open a file > with O_CREAT|O_EXCL. No, if I don't set errno, the continue statement will not iteration the loop, as the condition (fd == -1 && errno == EEXIST) is false. Unless I don't understand what you mean. FX