]> ruderich.org/simon Gitweb - nsscash/nsscash.git/commit
nss: simplify initialization of struct file in map_file()
authorSimon Ruderich <simon@ruderich.org>
Mon, 10 Jun 2019 20:14:50 +0000 (22:14 +0200)
committerSimon Ruderich <simon@ruderich.org>
Mon, 10 Jun 2019 20:14:50 +0000 (22:14 +0200)
commit0d99032f2a22b97cd7c49bfba4a6cd0b41fd87d6
treeba2f935b43de8c625b0fb26af1f9fa090f9f484b
parent98f2fc8312dc5611bd85229f0b6faa0a4356ea66
nss: simplify initialization of struct file in map_file()

It's not necessary to initialize ->fd at the beginning of map_file() as
the call to open(2) will overwrite it anyway.

Also adapt a check for a valid file descriptor. Although POSIX states
that open(2) returns -1 on error, there is no reason to hard-code this
constant. Instead, check for any negative value.
nss/file.c