mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Disable usage of O_TMPFILE for now
This commit is contained in:
10
src/tmp.zig
10
src/tmp.zig
@@ -2,13 +2,17 @@ const bun = @import("root").bun;
|
||||
const std = @import("std");
|
||||
const Environment = bun.Environment;
|
||||
const O = std.os.O;
|
||||
|
||||
// O_TMPFILE doesn't seem to work very well.
|
||||
const allow_tmpfile = false;
|
||||
|
||||
// To be used with files
|
||||
// not folders!
|
||||
pub const Tmpfile = struct {
|
||||
destination_dir: bun.FileDescriptor = bun.invalid_fd,
|
||||
tmpfilename: [:0]const u8 = "",
|
||||
fd: bun.FileDescriptor = bun.invalid_fd,
|
||||
using_tmpfile: bool = Environment.isLinux,
|
||||
using_tmpfile: bool = allow_tmpfile,
|
||||
|
||||
pub fn create(
|
||||
destination_dir: bun.FileDescriptor,
|
||||
@@ -21,7 +25,7 @@ pub const Tmpfile = struct {
|
||||
};
|
||||
|
||||
open: while (true) {
|
||||
if (comptime Environment.isLinux) {
|
||||
if (comptime allow_tmpfile) {
|
||||
switch (bun.sys.openat(destination_dir, ".", O.WRONLY | O.TMPFILE | O.CLOEXEC, perm)) {
|
||||
.result => |fd| {
|
||||
tmpfile.fd = fd;
|
||||
@@ -49,7 +53,7 @@ pub const Tmpfile = struct {
|
||||
}
|
||||
|
||||
pub fn finish(this: *Tmpfile, destname: [:0]const u8) !void {
|
||||
if (comptime Environment.isLinux) {
|
||||
if (comptime allow_tmpfile) {
|
||||
if (this.using_tmpfile) {
|
||||
var retry = true;
|
||||
const basename: [:0]const u8 = @ptrCast(std.fs.path.basename(destname));
|
||||
|
||||
Reference in New Issue
Block a user