Split g_file_open() into _ro() and _rw() variants
Rename g_file_open() to g_file_open_rw(), and add a new g_file_open_ro() call that wraps the common g_file_open_ex(file, 1, 0, 0, 0) idiom. This will make the file access mode more explicit in the code. Change all calls to g_file_open() to the _ro() or _rw() variant as appropriate, and replace g_file_open_ex(file, 1, 0, 0, 0) with the _ro() call. Lastly, add tests for the two new calls to test_os_calls.c (code courteously provided by matt335672).
This commit is contained in:
@@ -462,7 +462,7 @@ clipboard_send_file_data(int streamId, int lindex,
|
||||
"nPositionLow %d cbRequested %d", streamId, lindex,
|
||||
nPositionLow, cbRequested);
|
||||
g_snprintf(full_fn, 255, "%s/%s", cfi->pathname, cfi->filename);
|
||||
fd = g_file_open_ex(full_fn, 1, 0, 0, 0);
|
||||
fd = g_file_open_ro(full_fn);
|
||||
if (fd == -1)
|
||||
{
|
||||
LOG(LOG_LEVEL_ERROR, "clipboard_send_file_data: file open [%s] failed: %s",
|
||||
|
||||
Reference in New Issue
Block a user