aboutsummaryrefslogtreecommitdiff
path: root/lib/lockfile.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2013-06-24 10:54:49 -0700
committerBen Pfaff <blp@nicira.com>2013-06-28 16:09:38 -0700
commit10a89ef04df5669c5cdd02f786150a7ab8454e01 (patch)
tree8c921735df6d0dca97df88af70e986c4fdf38dca /lib/lockfile.c
parent5fcbed7479c5f1d2cc08c3f544f10dbbe8ec0d90 (diff)
Replace all uses of strerror() by ovs_strerror(), for thread safety.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/lockfile.c')
-rw-r--r--lib/lockfile.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/lockfile.c b/lib/lockfile.c
index c37f332f..14e553d2 100644
--- a/lib/lockfile.c
+++ b/lib/lockfile.c
@@ -1,4 +1,4 @@
- /* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
+ /* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -118,7 +118,7 @@ lockfile_lock(const char *file, struct lockfile **lockfilep)
"pid %ld", lock_name, (long int) pid);
} else {
VLOG_WARN("%s: failed to lock file: %s",
- lock_name, strerror(error));
+ lock_name, ovs_strerror(error));
}
}
@@ -225,7 +225,7 @@ lockfile_try_lock(const char *name, pid_t *pidp, struct lockfile **lockfilep)
}
} else if (errno != ENOENT) {
VLOG_WARN("%s: failed to stat lock file: %s",
- name, strerror(errno));
+ name, ovs_strerror(errno));
return errno;
}
@@ -233,13 +233,14 @@ lockfile_try_lock(const char *name, pid_t *pidp, struct lockfile **lockfilep)
fd = open(name, O_RDWR | O_CREAT, 0600);
if (fd < 0) {
VLOG_WARN("%s: failed to open lock file: %s",
- name, strerror(errno));
+ name, ovs_strerror(errno));
return errno;
}
/* Get the inode and device number for the lock table. */
if (fstat(fd, &s)) {
- VLOG_ERR("%s: failed to fstat lock file: %s", name, strerror(errno));
+ VLOG_ERR("%s: failed to fstat lock file: %s",
+ name, ovs_strerror(errno));
close(fd);
return errno;
}