diff options
author | Michał Górny <mgorny@moritz.systems> | 2021-08-06 21:32:41 +0200 |
---|---|---|
committer | Michał Górny <mgorny@moritz.systems> | 2021-09-08 15:28:03 +0200 |
commit | 2c6d90d7410b77798699ff2fff4182d83db79164 (patch) | |
tree | 6ed8c8c1938e21d7047cb53a08bfa33e5eeeacc9 /lldb/source/Commands/CommandObjectPlatform.cpp | |
parent | 4e0ea2cf2e7c5f04c526f5476eff70280f3c0871 (diff) | |
download | llvm-2c6d90d7410b77798699ff2fff4182d83db79164.zip llvm-2c6d90d7410b77798699ff2fff4182d83db79164.tar.gz llvm-2c6d90d7410b77798699ff2fff4182d83db79164.tar.bz2 |
[lldb] [Commands] Remove 'append' from 'platform file open' mode
Remove File::eOpenOptionAppend from the mode used by 'platform file
open' command. According to POSIX, O_APPEND causes all successive
writes to be done at the end of the file. This effectively makes
the offset argument to 'platform file write' meaningless.
Furthermore, apparently O_APPEND is not implemented reliably everywhere.
The Linux manpage for pwrite(2) suggests that Linux does respect
O_APPEND there while according to POSIX it should not, so the actual
behavior would be dependent on how the vFile:pwrite packet is
implemented on the server.
Ideally, the mode used for opening flags would be provided via options.
However, changing the default mode seems to be a reasonable intermediate
solution.
Differential Revision: https://reviews.llvm.org/D107664
Diffstat (limited to 'lldb/source/Commands/CommandObjectPlatform.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectPlatform.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index 8dd0512..0274605 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -498,8 +498,7 @@ public: lldb::eFilePermissionsWorldRead; lldb::user_id_t fd = platform_sp->OpenFile( FileSpec(cmd_line), - File::eOpenOptionReadWrite | File::eOpenOptionAppend | - File::eOpenOptionCanCreate, + File::eOpenOptionReadWrite | File::eOpenOptionCanCreate, perms, error); if (error.Success()) { result.AppendMessageWithFormat("File Descriptor = %" PRIu64 "\n", fd); |