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 <[email protected]>
---
 os/utils.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/os/utils.c b/os/utils.c
index b49fd32..6461ed5 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -248,16 +248,14 @@ 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];
 
   if (nolock) return;
   /*
    * 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);
-- 
1.7.3.2

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to