]> arthur.barton.de Git - netatalk.git/blobdiff - bin/megatron/asingle.c
logger: remove flood protection and allocate messages
[netatalk.git] / bin / megatron / asingle.c
index 60c754f0ac8fae5a6acd4679c806b8e6f7352007..9ba3918b6a0a2dfa65b7d6de7b6e022003e74f50 100644 (file)
@@ -1,5 +1,4 @@
 /*
- * $Id: asingle.c,v 1.14 2010-01-27 21:27:53 didg Exp $
  */
 
 #ifdef HAVE_CONFIG_H
 #include <sys/uio.h>
 #include <sys/time.h>
 #include <sys/param.h>
-#ifdef HAVE_FCNTL_H
 #include <fcntl.h>
-#endif /* HAVE_FCNTL_H */
 #include <time.h>
 #include <string.h>
 #include <ctype.h>
 #include <stdio.h>
-#ifdef HAVE_UNISTD_H
 #include <unistd.h>
-#endif /* HAVE_UNISTD_H */
+
 #include <atalk/adouble.h>
 #include <netatalk/endian.h>
 #include "asingle.h"
@@ -118,7 +114,7 @@ int single_header_read( struct FHeader *fh, int version)
  * entry_buf is used for reading in entry descriptors, and for reading in
  *     the actual entries of FILEINFO, FINDERINFO, and DATES.
  */
-    u_char             entry_buf[ 16 ];
+    u_char             entry_buf[ADEDLEN_FINDERI];
     u_int32_t          entry_id;
     u_int32_t          time_seconds;
     u_short            mask = 0xfcee;
@@ -204,15 +200,14 @@ int single_header_read( struct FHeader *fh, int version)
            return( -1 );
        }
     }
-    if (( single.entry[ ADEID_FINDERI ].ade_len < 16 ) ||
+    if (( single.entry[ ADEID_FINDERI ].ade_len < ADEDLEN_FINDERI ) ||
            ( single.entry[ ADEID_FINDERI ].ade_off <= AD_HEADER_LEN )) {
        fprintf( stderr, "%s has bogus FinderInfo.\n", single.path );
        return( -1 );
     } else {
        pos = lseek( single.filed,
                single.entry[ ADEID_FINDERI ].ade_off, SEEK_SET );
-       if ( read( single.filed, (char *)entry_buf, sizeof( entry_buf )) !=
-               sizeof( entry_buf )) {
+       if ( read( single.filed, (char *)entry_buf, ADEDLEN_FINDERI) != ADEDLEN_FINDERI) {
            perror( "Premature end of file :" );
            return( -1 );
        }