Skip to content
  • Philip Withnall's avatar
    gfileutils: Add a mode argument to g_file_set_contents_full() · 24ed91ce
    Philip Withnall authored
    This is used when creating the temporary file, or new file from scratch.
    
    I wondered about also allowing the file owner and group to be set, but
    that’s not as generally applicable — if your process is operating across
    multiple user IDs then it likely has some fairly OS-specific
    requirements and will need tighter control of its syscalls anyway.
    
    (Eventually, support for setting the file owner and group atomically
    could be added by writing out a file using `O_TMPFILE` so it’s not
    addressable, and then linking it into the file system in place of the
    old file using something like `renameat2(AT_EMPTY_PATH)` or `linkat()`.
    That’s currently not possible without patching the kernel with
    https://marc.info/?l=linux-fsdevel&m=152472898003523&w=2
    
    , as far as I
    know at the moment.)
    
    Signed-off-by: default avatarPhilip Withnall <withnall@endlessm.com>
    
    Fixes: #1203
    24ed91ce