Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:26
erlang
1842-kernel-file-Don-t-send-delete_file-2-args-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1842-kernel-file-Don-t-send-delete_file-2-args-to-file-se.patch of Package erlang
From 039a3bddb1d61764fd17c4b5bff66c038fdb2f74 Mon Sep 17 00:00:00 2001 From: jdamanalo <jamanalo5@up.edu.ph> Date: Fri, 12 May 2023 00:24:15 +0800 Subject: [PATCH 2/2] kernel/file: Don't send delete_file/2 args to file server --- lib/kernel/src/file.erl | 7 +++---- lib/kernel/test/file_SUITE.erl | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl index fbcc5f839b..a3bfb2cac2 100644 --- a/lib/kernel/src/file.erl +++ b/lib/kernel/src/file.erl @@ -220,15 +220,14 @@ delete(Name) -> Reason :: posix() | badarg. delete(Name, Opts) when is_list(Opts) -> - Args = [file_name(Name), Opts], - case check_args(Args) of + FileName = file_name(Name), + case check_args(Opts) of ok -> case lists:member(raw, Opts) of true -> - [FileName|_] = Args, ?PRIM_FILE:delete(FileName); false -> - call(delete, Args) + call(delete, [FileName]) end; Error -> Error diff --git a/lib/kernel/test/file_SUITE.erl b/lib/kernel/test/file_SUITE.erl index dbad5cb92e..7a2b0477e2 100644 --- a/lib/kernel/test/file_SUITE.erl +++ b/lib/kernel/test/file_SUITE.erl @@ -2339,6 +2339,23 @@ delete(Config) when is_list(Config) -> {error, _} = ?FILE_MODULE:open(Name2, read), %% Try deleting a nonexistent file with the raw option {error, enoent} = ?FILE_MODULE:delete(Name2, [raw]), + + Name3 = filename:join(RootDir, + atom_to_list(?MODULE) + ++"_delete_3.fil"), + {ok, Fd5} = ?FILE_MODULE:open(Name3, write), + io:format(Fd5,"ok.\n",[]), + ok = ?FILE_MODULE:close(Fd5), + %% Check that the file is readable + {ok, Fd6} = ?FILE_MODULE:open(Name3, read), + ok = ?FILE_MODULE:close(Fd6), + %% Try deleting with no option, should be equivalent to delete/1 + ok = ?FILE_MODULE:delete(Name3, []), + %% Check that the file is not readable anymore + {error, _} = ?FILE_MODULE:open(Name3, read), + %% Try deleting a nonexistent file with no option + {error, enoent} = ?FILE_MODULE:delete(Name3, []), + [] = flush(), ok. -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor