* Fix issue with autoconf-2.63
authorChristos Zoulas <christos@zoulas.com>
Mon, 26 Oct 2009 17:27:43 +0000 (13:27 -0400)
committerChristos Zoulas <christos@zoulas.com>
Mon, 26 Oct 2009 17:27:43 +0000 (13:27 -0400)
* Fix warnings for gcc-4.4

13 files changed:
ChangeLog
amd/amfs_program.c
amd/conf_tok.l
amd/ops_tmpfs.c
amd/readdir.c
amd/sun_map_tok.l
configure.in
fsinfo/fsi_lex.l
hlfsd/homedir.c
hlfsd/stubs.c
include/am_defs.h
libamu/xutil.c
m4/macros/save_state.m4

index 43ff96e2ec5359bad79dbd4881542da21d8dcce5..3dc67728e3a27fc2ca5bed77d8ef7012ca4e9d93 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-10-26  Christos Zoulas <christos@zoulas.com>
+
+       * Fix issue with autoconf 2.63
+
+       * Fix compile warnings for gcc-4.4.x
+
 2009-04-15  Christos Zoulas <christos@zoulas.com>
 
        * Share the LDAP connection between different maps to save resources
index 7d332f0001b674ac81628ff2e6ac706cf6a5bf90..8b6f2bda34f102a39107e429fdce59131f4cdca1 100644 (file)
@@ -147,10 +147,12 @@ amfs_program_exec(char *info)
   (void) fclose(stdout);
   if (!logfp)
     logfp = stderr;            /* initialize before possible first use */
-  (void) dup(fileno(logfp));
+    if (dup(fileno(logfp)) == -1)
+      return errno;
   if (fileno(logfp) != fileno(stderr)) {
     (void) fclose(stderr);
-    (void) dup(fileno(logfp));
+    if (dup(fileno(logfp)) == -1)
+      return errno;
   }
 
   /*
index a5fa0483fa53fc34503d7714236d76eaeddf87f2..d6f25e7decdff98673327827e0bb04975d9c9e45 100644 (file)
@@ -74,7 +74,7 @@
  */
 #ifdef FLEX_SCANNER
 # ifndef ECHO
-#  define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#  define ECHO __IGNORE(fwrite( yytext, yyleng, 1, yyout ))
 # endif /* not ECHO */
 #endif /* FLEX_SCANNER */
 
index fa6454431a1a75fdf6c3f6f1ed896589c7c98893..7c8da58e1998c071aada5d4afe8ab34f6fc163ea 100644 (file)
@@ -109,6 +109,7 @@ mount_tmpfs(char *mntdir, char *fs_name, char *opts, int on_autofs)
   mntent_t mnt;
   int flags;
   const char *p;
+  (void)&p;
 
   /*
    * Figure out the name of the file system type.
index fb8e546339cb88a038cc38360421492bd83aa643..b43a3891f476a43a2280a2f4f35732d005b9986b 100644 (file)
@@ -63,6 +63,7 @@ static int key_already_in_chain(char *keyname, const nfsentry *chain);
 static nfsentry *make_entry_chain(am_node *mp, const nfsentry *current_chain, int fully_browsable);
 static int amfs_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count, int fully_browsable);
 
+static const u_int dotdotcookie = DOT_DOT_COOKIE;
 
 /****************************************************************************
  *** FUNCTIONS                                                             ***
@@ -178,8 +179,9 @@ make_entry_chain(am_node *mp, const nfsentry *current_chain, int fully_browsable
 
       /* we have space.  put entry in next cell */
       ++last_cookie;
-      chain[num_entries].ne_fileid = (u_int) last_cookie;
-      *(u_int *) chain[num_entries].ne_cookie = (u_int) last_cookie;
+      chain[num_entries].ne_fileid = last_cookie;
+      (void)memcpy(chain[num_entries].ne_cookie, &last_cookie,
+       sizeof(last_cookie));
       chain[num_entries].ne_name = key;
       if (num_entries < max_entries - 1) {     /* link to next one */
        chain[num_entries].ne_nextentry = &chain[num_entries + 1];
@@ -253,7 +255,7 @@ amfs_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *
     ep[0].ne_fileid = mp->am_gen;
     ep[0].ne_name = ".";
     ep[0].ne_nextentry = &ep[1];
-    *(u_int *) ep[0].ne_cookie = 0;
+    (void)memset(ep[0].ne_cookie, 0, sizeof(u_int));
 
     /* construct ".." */
     if (mp->am_parent)
@@ -263,7 +265,7 @@ amfs_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *
 
     ep[1].ne_name = "..";
     ep[1].ne_nextentry = NULL;
-    *(u_int *) ep[1].ne_cookie = DOT_DOT_COOKIE;
+    (void)memcpy(ep[1].ne_cookie, &dotdotcookie, sizeof(dotdotcookie));
 
     /*
      * If map is browsable, call a function make_entry_chain() to construct
@@ -300,9 +302,12 @@ amfs_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *
       nfsentry *ne;
       for (j = 0, ne = te; ne; ne = ne->ne_nextentry)
        plog(XLOG_DEBUG, "gen2 key %4d \"%s\"", j++, ne->ne_name);
-      for (j = 0, ne = ep; ne; ne = ne->ne_nextentry)
+      for (j = 0, ne = ep; ne; ne = ne->ne_nextentry) {
+       u_int cookie;
+       (void)memcpy(&cookie, ne->ne_cookie, sizeof(cookie));
        plog(XLOG_DEBUG, "gen2+ key %4d \"%s\" fi=%d ck=%d",
-            j++, ne->ne_name, ne->ne_fileid, *(u_int *)ne->ne_cookie);
+            j++, ne->ne_name, ne->ne_fileid, cookie);
+      }
       plog(XLOG_DEBUG, "EOF is %d", dp->dl_eof);
     }
     return 0;
@@ -412,7 +417,7 @@ amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep
     ep[0].ne_fileid = mp->am_gen;
     ep[0].ne_name = ".";
     ep[0].ne_nextentry = &ep[1];
-    *(u_int *) ep[0].ne_cookie = 0;
+    (void)memset(ep[0].ne_cookie, 0, sizeof(u_int));
 
     /* construct ".." */
     if (mp->am_parent)
@@ -421,7 +426,8 @@ amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep
       ep[1].ne_fileid = mp->am_gen;
     ep[1].ne_name = "..";
     ep[1].ne_nextentry = NULL;
-    *(u_int *) ep[1].ne_cookie = (xp ? xp->am_gen : DOT_DOT_COOKIE);
+    (void)memcpy(ep[1].ne_cookie, (xp ? &xp->am_gen : &dotdotcookie),
+      sizeof(dotdotcookie));
 
     if (!xp)
       dp->dl_eof = TRUE;       /* by default assume readdir done */
@@ -429,9 +435,12 @@ amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep
     if (amuDebug(D_READDIR)) {
       nfsentry *ne;
       int j;
-      for (j = 0, ne = ep; ne; ne = ne->ne_nextentry)
+      for (j = 0, ne = ep; ne; ne = ne->ne_nextentry) {
+       u_int cookie;
+       (void)memcpy(&cookie, ne->ne_cookie, sizeof(cookie));
        plog(XLOG_DEBUG, "gen1 key %4d \"%s\" fi=%d ck=%d",
-            j++, ne->ne_name, ne->ne_fileid, *(u_int *)ne->ne_cookie);
+            j++, ne->ne_name, ne->ne_fileid, cookie);
+      }
     }
     return 0;
   }
@@ -460,9 +469,9 @@ amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep
       am_node *xp_next = next_nonerror_node(xp->am_osib);
 
       if (xp_next) {
-       *(u_int *) ep->ne_cookie = xp_next->am_gen;
+       (void)memcpy(ep->ne_cookie, &xp_next->am_gen, sizeof(xp_next->am_gen));
       } else {
-       *(u_int *) ep->ne_cookie = DOT_DOT_COOKIE;
+       (void)memcpy(ep->ne_cookie, &dotdotcookie, sizeof(dotdotcookie));
        dp->dl_eof = TRUE;
       }
 
@@ -488,9 +497,12 @@ amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep
     if (amuDebug(D_READDIR)) {
       nfsentry *ne;
       int j;
-      for (j=0,ne=ep; ne; ne=ne->ne_nextentry)
+      for (j=0,ne=ep; ne; ne=ne->ne_nextentry) {
+       u_int cookie;
+       (void)memcpy(&cookie, ne->ne_cookie, sizeof(cookie));
        plog(XLOG_DEBUG, "gen2 key %4d \"%s\" fi=%d ck=%d",
-            j++, ne->ne_name, ne->ne_fileid, *(u_int *)ne->ne_cookie);
+            j++, ne->ne_name, ne->ne_fileid, cookie);
+      }
     }
     return 0;
   }
index c8e92581a04fb4678ae61b7fc87eae36409653f4..ff3fab48447f071157e0af8ce4b2c96192137fd3 100644 (file)
@@ -71,7 +71,7 @@
  */
 #ifdef FLEX_SCANNER
 # ifndef ECHO
-#  define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#  define ECHO __IGNORE(fwrite( yytext, yyleng, 1, yyout ))
 # endif /* not ECHO */
 #endif /* FLEX_SCANNER */
 
index fc1e40cffb9583d6444d5337154dcb0442cf479f..8911bc8d50e12e0661a96427d7db3d53bc77157d 100644 (file)
@@ -895,6 +895,7 @@ dnl ######################################################################
 dnl SYSTEM SERVICES
 AC_MSG_NOTICE(*** SYSTEM SERVICES ***)
 AC_SYS_LONG_FILE_NAMES
+AC_SYS_LARGEFILE
 AC_SYS_RESTARTABLE_SYSCALLS
 AMU_CHECK_NETWORK_TRANSPORT_TYPE
 dnl ======================================================================
index 0f9a3862c30dbaba29285e0893c540d562fd3baa..c296ac213ccabbb6aebf51c5692888dc09091073 100644 (file)
@@ -102,7 +102,7 @@ static int ayylineno;
  */
 #ifdef FLEX_SCANNER
 # ifndef ECHO
-#  define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#  define ECHO __IGNORE(fwrite( yytext, yyleng, 1, yyout ))
 # endif /* not ECHO */
 #endif /* FLEX_SCANNER */
 
index f2073658197f6de99ed4980b832490e4a3ddb72c..00423f40277545e4aa0ad5374810148d185cb542 100644 (file)
@@ -494,9 +494,10 @@ readent:
 
   /* read records */
   buf[0] = '\0';
-  fgets(buf, 256, passwd_fp);
+  if (fgets(buf, 256, passwd_fp) == NULL)
+    return NULL;
   passwd_line++;
-  if (!buf || buf[0] == '\0')
+  if (buf[0] == '\0')
     goto readent;
 
   /* read user name */
index 8dcbf38e2d601b3c673a789645e59e8a98f9aeaa..accc04aca70d7b59249ff0f9b122cc10bef2dc73 100644 (file)
@@ -164,8 +164,7 @@ nfsproc_getattr_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
     if (gid != hlfs_gid) {
       res.ns_status = NFSERR_STALE;
     } else {
-      memset((char *) &uid, 0, sizeof(int));
-      uid = *(u_int *) argp->fh_data;
+      (void)memcpy(&uid, argp->fh_data, sizeof(uid));
       if (plt_search(uid) != (uid2home_t *) NULL) {
        res.ns_status = NFS_OK;
        un_fattr.na_fileid = uid;
@@ -282,8 +281,8 @@ nfsproc_lookup_2_svc(nfsdiropargs *argp, struct svc_req *rqstp)
     } else {                   /* entry found and gid is permitted */
       un_fattr.na_fileid = untab[idx].uid;
       res.dr_u.dr_drok_u.drok_attributes = un_fattr;
-      memset((char *) &un_fhandle, 0, sizeof(am_nfs_fh));
-      *(u_int *) un_fhandle.fh_data = (u_int) untab[idx].uid;
+      memset(&un_fhandle, 0, sizeof(un_fhandle));
+      memcpy(un_fhandle.fh_data, &untab[idx].uid, sizeof(untab[idx].uid));
       xstrlcpy((char *) &un_fhandle.fh_data[sizeof(int)],
               untab[idx].username,
               sizeof(am_nfs_fh) - sizeof(int));
@@ -338,8 +337,7 @@ nfsproc_readlink_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
     }
 
     if (groupid == hlfs_gid) {
-      memset((char *) &userid, 0, sizeof(int));
-      userid = *(u_int *) argp->fh_data;
+      memcpy(&userid, argp->fh_data, sizeof(userid));
       username = (char *) &argp->fh_data[sizeof(int)];
       if (!(res.rlr_u.rlr_data_u = mailbox(userid, username)))
        return (nfsreadlinkres *) NULL;
index 9e0d984607bc3dee4f96c0a3cf5ebc3fae46d11f..a74d0609d8325858f9e481e10a954e452da4ed80 100644 (file)
@@ -49,8 +49,6 @@
 #ifndef _AM_DEFS_H
 #define _AM_DEFS_H
 
-#define _LARGEFILE64_SOURCE
-
 /*
  * Actions to take if ANSI C.
  */
@@ -88,6 +86,14 @@ char *strchr(), *strrchr(), *strdup();
 # endif /* __GNUC__ < 2 ... */
 #endif /* not __attribute__ */
 
+#define __IGNORE(result) \
+    __ignore((unsigned long)result)
+
+static __inline void
+__ignore(unsigned long result) {
+    (void)&result;
+}
+
 /*
  * How to handle signals of any type
  */
index 3c643f5ab603dc3dfa7d46aea85e0afd3cb03d20..16b93b4ae7e7d1a232e0907bf634b836eb0b1c64 100644 (file)
@@ -524,7 +524,7 @@ real_plog(int lvl, const char *fmt, va_list vargs)
       fprintf(stderr, "real_plog: string \"%s\" truncated to \"%s\"\n", last_msg, msg);
     last_lvl = lvl;
     show_time_host_and_name(lvl); /* mimic syslog header */
-    fwrite(msg, ptr - msg, 1, logfp);
+    __IGNORE(fwrite(msg, ptr - msg, 1, logfp));
     fflush(logfp);
     break;
 
@@ -537,7 +537,7 @@ real_plog(int lvl, const char *fmt, va_list vargs)
        fprintf(stderr, "real_plog: string \"%s\" truncated to \"%s\"\n", last_msg, msg);
       last_lvl = lvl;
       show_time_host_and_name(lvl); /* mimic syslog header */
-      fwrite(msg, ptr - msg, 1, logfp);
+      __IGNORE(fwrite(msg, ptr - msg, 1, logfp));
       fflush(logfp);
     }
     break;
@@ -550,7 +550,7 @@ real_plog(int lvl, const char *fmt, va_list vargs)
     show_time_host_and_name(last_lvl);
     xsnprintf(last_msg, sizeof(last_msg),
              "last message repeated %d times\n", last_count);
-    fwrite(last_msg, strlen(last_msg), 1, logfp);
+    __IGNORE(fwrite(last_msg, strlen(last_msg), 1, logfp));
     fflush(logfp);
     last_count = 0;            /* start from scratch */
     break;
@@ -562,13 +562,13 @@ real_plog(int lvl, const char *fmt, va_list vargs)
       show_time_host_and_name(last_lvl);
       xsnprintf(last_msg, sizeof(last_msg),
                "last message repeated %d times\n", last_count);
-      fwrite(last_msg, strlen(last_msg), 1, logfp);
+      __IGNORE(fwrite(last_msg, strlen(last_msg), 1, logfp));
       if (strlcpy(last_msg, msg, 1024) >= 1024) /* don't use xstrlcpy here (recursive!) */
        fprintf(stderr, "real_plog: string \"%s\" truncated to \"%s\"\n", last_msg, msg);
       last_count = 1;
       last_lvl = lvl;
       show_time_host_and_name(lvl); /* mimic syslog header */
-      fwrite(msg, ptr - msg, 1, logfp);
+      __IGNORE(fwrite(msg, ptr - msg, 1, logfp));
       fflush(logfp);
     }
     break;
@@ -824,7 +824,7 @@ switch_to_logfile(char *logfile, int old_umask, int truncate_log)
     } else {                   /* regular log file */
       (void) umask(old_umask);
       if (truncate_log)
-       truncate(logfile, 0);
+       __IGNORE(truncate(logfile, 0));
       new_logfp = fopen(logfile, "a");
       umask(0);
     }
index 15d533e25b7247ed4df3ad2a269644facbb9e8c0..abc7b55fb00ac4b71c7f3f72db418a7ff6707bab 100644 (file)
@@ -7,6 +7,7 @@ if test -f confdefs.h
 then
  cp confdefs.h dbgcf.h
 fi
-[AC_CACHE_SAVE]
+[AC_CACHE_SAVE
+AC_MSG_NOTICE([*** SAVING CONFIGURE STATE ***])]
 )
 dnl ======================================================================