summaryrefslogtreecommitdiff
path: root/os/utils.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-12-12 16:49:33 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-12-12 17:03:10 -0800
commit3839d1480877818f3ccc04e25237d853bab210c3 (patch)
tree0bc14fef8081c8a48fccc2975a396251d8cec275 /os/utils.c
parentaf4113bfeb1d155f5f037c3492e50513336fa4a7 (diff)
LockServer: store path to LOCKDIR literal string in a const char *
And instead of initializing to NULL, then resetting to LOCKDIR almost immediately (before ever using the NULL value), skip directly to setting it to LOCKDIR. tmppath variable is only used as input for generating the path name via calls to strlen, sprintf, etc. Fixes gcc warning of: utils.c: In function 'LockServer': utils.c:259:11: warning: assignment discards qualifiers from pointer target type Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'os/utils.c')
-rw-r--r--os/utils.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/os/utils.c b/os/utils.c
index b49fd3251..6461ed591 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -248,7 +248,7 @@ LockServer(void)
{
char tmp[PATH_MAX], pid_str[12];
int lfd, i, haslock, l_pid, t;
- char *tmppath = NULL;
+ const char *tmppath = LOCK_DIR;
int len;
char port[20];
@@ -256,8 +256,6 @@ LockServer(void)
/*
* Path names
*/
- tmppath = LOCK_DIR;
-
snprintf(port, sizeof(port), "%d", atoi(display));
len = strlen(LOCK_PREFIX) > strlen(LOCK_TMP_PREFIX) ? strlen(LOCK_PREFIX) :
strlen(LOCK_TMP_PREFIX);