20441798 Fix parfait errors for dsession
authorhenryzh <henry.zhao@oracle.com>
Tue, 07 Apr 2015 22:40:53 -0700
changeset 1455 13da37c0271e
parent 1454 1fc14fd34b1e
child 1456 1e35333a50b6
20441798 Fix parfait errors for dsession
open-src/app/dsession/sun-src/dsession.c
--- a/open-src/app/dsession/sun-src/dsession.c	Mon Apr 06 08:12:41 2015 -0700
+++ b/open-src/app/dsession/sun-src/dsession.c	Tue Apr 07 22:40:53 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files(the "Software"),
@@ -211,7 +211,7 @@
 
 	free(buf);
 
-	close(p_fd[0]);
+	fclose(fd);
 
 	if (waitpid(pid, &status, 0) != pid) {
 	    fprintf(stderr, "cmd_exec command %s: ", eargv[0]);
@@ -480,7 +480,7 @@
 	    }
 	}
 
-	close(p_fd[0]);
+	fclose(fd);
 
 	if (waitpid(pid, &status, 0) != pid) {
 	    perror("get_sessions: error waiting for child process");
@@ -746,7 +746,7 @@
 	}
 
     } else if (strcmp(type, "add") == 0) {
-	while (!verified && (count++ < RETRY_COUNT)) {
+	do {
 	    usleep(2000000);
 
 	    if (allsessions) {
@@ -775,7 +775,7 @@
 			(ck_sessions[0].display != -1))
 		    verified = TRUE;
 	    }
-	}
+	} while (!verified && (count++ < RETRY_COUNT));
 
 	if (allsessions) {
 	    /* add all sessions */
@@ -1568,7 +1568,7 @@
 }
 
 static Bool
-get_shm_key() {
+get_shm_key(void) {
     struct stat statbuf;
 
     if (stat(FTOK_FILE, &statbuf) != 0) {