Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > d236c5da97a239a1b6991cfba2865b66 > files > 69

cman-2.0.115-68.el5_6.1.src.rpm

From 7f650b2b853867922e1f5d38673c33e871f7b3bb Mon Sep 17 00:00:00 2001
From: Marek 'marx' Grac <mgrac@redhat.com>
Date: Wed, 23 Jun 2010 19:14:31 +0200
Subject: [PATCH] fence_rackswitch: fix warnings in build process

Resolves: rhbz#583045
---
 fence/agents/rackswitch/do_rack.c |   26 +++++++++++++++++++-------
 fence/agents/rackswitch/do_rack.h |    4 ----
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/fence/agents/rackswitch/do_rack.c b/fence/agents/rackswitch/do_rack.c
index d0e2764..921972f 100644
--- a/fence/agents/rackswitch/do_rack.c
+++ b/fence/agents/rackswitch/do_rack.c
@@ -12,7 +12,7 @@
 ******************************************************************************/
 #include "do_rack.h"
 
-char *pname = "fence_rack";
+const char *pname = "fence_rack";
 
 int quiet_flag = 0;
 int verbose_flag = 0;
@@ -148,7 +148,7 @@ void ignore_message_status(void)
 
 
 
-void print_usage(void)
+static void print_usage(void)
 {
   printf("Usage:\n");
   printf("\n");
@@ -168,7 +168,7 @@ void print_usage(void)
 
 
 
-void get_options(int argc, char **argv)
+static void get_options(int argc, char **argv)
 {
   int c;
   char *value;
@@ -452,7 +452,10 @@ int main(int argc, char **argv)
   }
   writebuf[sizeof(char)+(strlen(username))+1+(strlen(password))+1] ='\n';
      
-  write(sock,writebuf,sizeof(char)+strlen(username)+strlen(password)+2);
+  if(write(sock,writebuf,sizeof(char)+strlen(username)+strlen(password)+2) < 0) {
+    fprintf(stderr,"failed to write to socket\n");
+    exit(DID_FAILURE);
+  }
    
   /********************************************
    ***
@@ -478,7 +481,10 @@ int main(int argc, char **argv)
  
  writebuf[0] = configuration_request;
  writebuf[1] = config_general;
- write(sock,writebuf,2*(sizeof(char)));
+ if(write(sock,writebuf,2*(sizeof(char))) < 0) {
+   fprintf(stderr,"failed to write to socket\n");
+   exit(DID_FAILURE);
+ }
 
  /********************************************
    ***
@@ -630,7 +636,10 @@ int main(int argc, char **argv)
  writebuf[(pnumb*5)+3] = (char)(pnumb);
  writebuf[(pnumb*5)+4] = action_offon;
 
- write(sock,writebuf,(pnumb*5)+5);
+ if(write(sock,writebuf,(pnumb*5)+5) < 0) {
+   fprintf(stderr,"failed to write to socket\n");
+   exit(DID_FAILURE);
+ }
  if(verbose_flag){
    printf("%s: sending action frame to switch:\n",name);
    for(i=0;i<(pnumb*5)+5;i++) 
@@ -647,7 +656,10 @@ int main(int argc, char **argv)
  writebuf[0] = configuration_request;
  writebuf[1] = boardnum;
  
- write(sock,writebuf,2*(sizeof(char)));
+ if(write(sock,writebuf,2*(sizeof(char))) < 0) {
+   fprintf(stderr,"failed to write to socket\n");
+   exit(DID_FAILURE);
+ }
  if(verbose_flag){
    printf("%s: sending Request Configuration Frame from switch:\n",name);
    printf("0x%.2x 0x%.2x\n",writebuf[0],writebuf[1]);
diff --git a/fence/agents/rackswitch/do_rack.h b/fence/agents/rackswitch/do_rack.h
index 613a021..63c1365 100644
--- a/fence/agents/rackswitch/do_rack.h
+++ b/fence/agents/rackswitch/do_rack.h
@@ -11,10 +11,6 @@
 #include <sys/socket.h>
 #include <sys/types.h>
 
-#include <linux/net.h>
-#include <linux/fs.h>
-#include <linux/socket.h>
-/*#include <linux/in.h>*/
 #include <arpa/inet.h>
 
 #include <signal.h>
-- 
1.6.0.6