ovsdb: Make "ovsdb-tool create" work through a dangling symlink.
authorBen Pfaff <blp@nicira.com>
Thu, 26 Jul 2012 21:42:58 +0000 (14:42 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 1 Aug 2012 17:05:34 +0000 (10:05 -0700)
commit01ca539f5c89fab1ea9a355d4cb75383dfb25da5
tree57884161802e8a7fb3ef9a2e7bb2dc73813e5bd6
parent77c513a44ab85264aed7c38387ef221ad30e461c
ovsdb: Make "ovsdb-tool create" work through a dangling symlink.

open() with O_CREAT|O_EXCL yields EEXIST if the name passed in is a
symlink, but we would like "ovsdb-tool create /etc/openvswitch/conf.db" to
work if /etc/openvswitch/conf.db is a symlink to elsewhere in the file
system.  This commit fixes the problem.  It introduces a theoretical race,
but no one should be doing "ovsdb-tool create" in parallel anyhow; O_EXCL
is just an idiot check here, not required to be fail-safe.

Debian bug #681880.
CC: 681880@bugs.debian.org
Reported-by: Bastian Blank <waldi@debian.org>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Reviewed-by: Simon Horman <horms@verge.net.au>
ovsdb/log.c