cbfstool: accept read-only files when possible
cbfstool tries opening the input file for write access even if the command does not require modifying the file. Let's not request write access unless it is necessary, this way one can examine write protected files without sudo. BRANCH=none BUG=none TEST=running cbfstool /build/<board>/firmware/image.bin print in chroot does not require root access any more. Change-Id: Ic4e4cc389b160da190e44a676808f5c4e6625567 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: ef6a8e25d9e257d7de4cc6b94e510234fe20a56d Original-Change-Id: I871f32f0662221ffbdb13bf0482cb285ec184d07 Original-Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/317300 Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/12931 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
committed by
Patrick Georgi
parent
6313bc7731
commit
7559946896
@@ -71,9 +71,11 @@ partitioned_file_t *partitioned_file_create(const char *filename,
|
||||
* caller, and must later be passed to partitioned_file_close();
|
||||
*
|
||||
* @param filename Name of the file to read in
|
||||
* @param write_access True if the file needs to be modified
|
||||
* @return Caller-owned partitioned file, or NULL on error
|
||||
*/
|
||||
partitioned_file_t *partitioned_file_reopen(const char *filename);
|
||||
partitioned_file_t *partitioned_file_reopen(const char *filename,
|
||||
bool write_access);
|
||||
|
||||
/**
|
||||
* Write a buffer's contents to its original region within a segmented file.
|
||||
|
Reference in New Issue
Block a user