]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libmount: fix access() utab write test
authorKarel Zak <kzak@redhat.com>
Wed, 8 Nov 2017 15:47:40 +0000 (16:47 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 8 Nov 2017 16:03:59 +0000 (17:03 +0100)
commit06ff935ec3ad2290025b555ff32b590680af565f
treee9650c7c99554bae3fa903e865048f99509fd806
parent5d9c79666087d81363b9b942f213d7840d2f695b
libmount: fix access() utab write test

The commit c08396c7691e1e6a04b6b45892e7e4612ceed8d7 replaces
open(O_CREATE) with ecaccess(). Unfortunately, another code depends on
the original behavior.

* let's make utab when really necessary rather than in the try_write() test

* __mnt_new_table_from_file() returns NULL if tab-file does not
 exists. This is incorrect for tab_update.c stuff. We need empty table
 in this case.

* we can check /run/mount/ directory for write access if
  eaccess(filename) return ENOENT (because file does not exist)

Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/mountP.h
libmount/src/tab_parse.c
libmount/src/tab_update.c
libmount/src/utils.c