20441798 Fix parfait errors for dsession s12_69
authorhenryzh <henry.zhao@oracle.com>
Tue, 24 Feb 2015 18:57:01 -0800
changeset 1510 ef06e61b3a1f
parent 1509 3161a3f7cef7
child 1511 ccf8aac0c8d9
20441798 Fix parfait errors for dsession
open-src/app/dsession/sun-src/dsession.c
--- a/open-src/app/dsession/sun-src/dsession.c	Fri Feb 20 14:26:15 2015 -0800
+++ b/open-src/app/dsession/sun-src/dsession.c	Tue Feb 24 18:57:01 2015 -0800
@@ -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 */