We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b03a270 commit ae20dbfCopy full SHA for ae20dbf
source/trashcan.d
@@ -335,9 +335,10 @@ private:
335
string timeString = currentTime.toISOExtString();
336
string contents = format("[Trash Info]\nPath=%s\nDeletionDate=%s\n", path.escapeValue(), timeString);
337
338
- auto mode = O_CREAT | O_WRONLY | O_EXCL;
339
- auto fd = open(toStringz(trashInfoPath), mode, octal!666);
340
- errnoEnforce(fd != 0);
+ const mode = O_CREAT | O_WRONLY | O_EXCL;
+ auto fd = .open(toStringz(trashInfoPath), mode, octal!666);
+ errnoEnforce(fd != -1);
341
+ scope(exit) .close(fd);
342
errnoEnforce(write(fd, contents.ptr, contents.length) == contents.length);
343
344
path.rename(trashFilePath);
0 commit comments