From bf691df17f134d651bf3a7e0badcd09aeabc405f Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sat, 25 Feb 2006 19:07:50 +0000
Subject: [PATCH] fix small warnings

---
 utils/solvers/c++/GmshClient.h | 3 ++-
 utils/solvers/c/GmshClient.c   | 5 +++--
 utils/solvers/c/solver.c       | 6 +++++-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/utils/solvers/c++/GmshClient.h b/utils/solvers/c++/GmshClient.h
index 6a2f00fd80..9c0b0ae1ee 100644
--- a/utils/solvers/c++/GmshClient.h
+++ b/utils/solvers/c++/GmshClient.h
@@ -135,8 +135,9 @@ class GmshClient {
 	return -1;  // Error: Couldn't create socket
       // try to connect socket to given name
       struct sockaddr_un addr_un;
-      strcpy(addr_un.sun_path, sockname);
+      memset((char *) &addr_un, 0, sizeof(addr_un));
       addr_un.sun_family = AF_UNIX;
+      strcpy(addr_un.sun_path, sockname);
       for(int tries = 0; tries < 5; tries++) {
 	if(connect(_sock, (struct sockaddr *)&addr_un, sizeof(addr_un)) >= 0)
 	  return _sock;
diff --git a/utils/solvers/c/GmshClient.c b/utils/solvers/c/GmshClient.c
index f0bd8909cf..54aa3d9344 100644
--- a/utils/solvers/c/GmshClient.c
+++ b/utils/solvers/c/GmshClient.c
@@ -1,4 +1,4 @@
-/* $Id: GmshClient.c,v 1.5 2006-02-25 00:15:01 geuzaine Exp $ */
+/* $Id: GmshClient.c,v 1.6 2006-02-25 19:07:50 geuzaine Exp $ */
 /*
  * Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
  *
@@ -131,8 +131,9 @@ int Gmsh_Connect(char *sockname)
     if(sock < 0)
       return -1; /* Error: Couldn't create socket */
     /* try to connect socket to given name */
-    strcpy(addr_un.sun_path, sockname);
+    memset((char *) &addr_un, 0, sizeof(addr_un));
     addr_un.sun_family = AF_UNIX;
+    strcpy(addr_un.sun_path, sockname);
     for(tries = 0; tries < 5; tries++) {
       if(connect(sock, (struct sockaddr *)&addr_un, sizeof(addr_un)) >= 0)
 	return sock;
diff --git a/utils/solvers/c/solver.c b/utils/solvers/c/solver.c
index dfa6a5aa7a..c53bbdc6a9 100644
--- a/utils/solvers/c/solver.c
+++ b/utils/solvers/c/solver.c
@@ -1,4 +1,4 @@
-/* $Id: solver.c,v 1.5 2006-02-25 14:36:53 geuzaine Exp $ */
+/* $Id: solver.c,v 1.6 2006-02-25 19:07:50 geuzaine Exp $ */
 /*
  * Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle
  *
@@ -47,6 +47,10 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#if !defined(WIN32) || defined(__CYGWIN__)
+#include <unistd.h>
+#endif
+
 #include "GmshClient.h"
 
 typedef enum { options, run } action;
-- 
GitLab