lockfile: Support \-delimited file names in lockfile_name().
authorAlin Serdean <aserdean@cloudbasesolutions.com>
Tue, 31 Mar 2015 19:16:58 +0000 (19:16 +0000)
committerBen Pfaff <blp@nicira.com>
Tue, 31 Mar 2015 23:29:25 +0000 (16:29 -0700)
commitd314fc84e09301f485733fc9fc7c64ce781eb513
tree31c6ea8bd92cf3465333473a8039361a81e0eb7c
parent5617ae6abe492498ee6350fe657a53e0ba21f8ba
lockfile: Support \-delimited file names in lockfile_name().

Currently paths that have only forward slashes like the following
"C:/package/binaries/conf.db" work seamlessly.

If we try the native windows filepaths i.e. "C:\package\binaries\conf.db" we
will hit the following problem:
2015-03-31T15:54:17Z|00001|lockfile|WARN|.c:\package\binaries\conf.db.~lock~:
failed to open lock file: Invalid argument

2015-03-31T15:54:17Z|00002|lockfile|WARN|.c:\package\binaries\conf.db.~lock~:
failed to lock file: Invalid argument
ovsdb-server: I/O error: c:\package\binaries\conf.db: failed to lock lockfile
(Invalid argument)

In this patch we update the lockfile_name function to also look for
backslashes, and also accommodate if we have a mix of backslashes and forward
slashes.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
[blp@nicira.com simplified the code]
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/lockfile.c