lib: Fix lstat check in directory_create_or_exist
authorChristof Schmitt <cs@samba.org>
Wed, 29 Aug 2018 19:04:29 +0000 (12:04 -0700)
committerChristof Schmitt <cs@samba.org>
Thu, 30 Aug 2018 16:07:14 +0000 (18:07 +0200)
commit9f60a77e0b4c8ad06a8156ff5b5ebc5902d4ec17
tree2cdb21ce5137a7515695e03427505c6e70e915fb
parent58b8f2a31e30a9fe9180f3758acaebf7deffbd91
lib: Fix lstat check in directory_create_or_exist

The lstat check in directory_create_or_exist did not verify whether an
existing object is actually a directory. Also move the check to only
apply when mkdir returns EEXIST; this fixes CID 241930 Time of check
time of use.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
lib/util/util.c