On 25/02/23 09:51AM, Ritvik Gupta wrote:
Yes, the kernel will handle the 'fd' cleanup automatically, but the existing implementation already closes it before exiting. However, in case where write fails, its unhandled. This patch addresses that gap :)
Nevertheless it's subjective indeed. Thanks for reviewing!
Regards Ritvik
The current implementation doesn't close the fd before calling the die() function. It only closes fd before returning because vmaybe_write_file() doesn't necessarily exit the process. It only exits in failure cases, including failures when closing the file itself. I think the close() failure path might have caused some confusion.
Cheers, Seyediman