aboutsummaryrefslogtreecommitdiffstats
path: root/main/app.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-12 16:24:45 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2007-09-12 16:24:45 +0000
commit894372bbe84725756b37d4a221c5c5e77b4ddada (patch)
tree570f09319a24484f44e08ae4ea4af7a64d86d8d5 /main/app.c
parent6fa2c158ccddb95d834c53ca65ed99fe05d65d0d (diff)
Fixes Solaris build warnings
(closes issue #10698, reported and patched by snuffy) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@82283 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/app.c')
-rw-r--r--main/app.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/main/app.c b/main/app.c
index a026f2b8b..0d6d96666 100644
--- a/main/app.c
+++ b/main/app.c
@@ -39,6 +39,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include <sys/stat.h>
#include <sys/file.h>
#include <regex.h>
+#include <fcntl.h>
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
@@ -1146,8 +1147,14 @@ static enum AST_LOCK_RESULT ast_lock_path_flock(const char *path)
pl->path = strdup(path);
time(&start);
- while (((res = flock(pl->fd, LOCK_EX | LOCK_NB)) < 0) &&
- (errno == EWOULDBLOCK) && (time(NULL) - start < 5))
+ while ((
+ #ifdef SOLARIS
+ (res = fcntl(pl->fd, F_SETLK, fcntl(pl->fd,F_GETFL)|O_NONBLOCK)) < 0) &&
+ #else
+ (res = flock(pl->fd, LOCK_EX | LOCK_NB)) < 0) &&
+ #endif
+ (errno == EWOULDBLOCK) &&
+ (time(NULL) - start < 5))
usleep(1000);
if (res) {
ast_log(LOG_WARNING, "Failed to lock path '%s': %s\n",