]> arthur.barton.de Git - netatalk.git/blobdiff - bin/psorder/psorder.c
Remove bdb env on exit
[netatalk.git] / bin / psorder / psorder.c
index d2de6c87627fe3687ee604b1565b3d0c5aabb7c4..4a37bab579fc59dfd8124ecfda4b6a33e0027c78 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: psorder.c,v 1.8 2009-10-14 01:38:28 didg Exp $
+ * $Id: psorder.c,v 1.10 2010-04-12 14:28:47 franklahm Exp $
  *
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
  * All Rights Reserved.
@@ -35,6 +35,7 @@
 #include <sys/uio.h>
 #include <sys/file.h>
 #include <ctype.h>
+#include <limits.h>
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif /* HAVE_FCNTL_H */
@@ -111,7 +112,11 @@ filesetup( char *inputfile, int *infd, char *tfile, int *tfd)
        make temporary file
  */
 
-    strncpy( tfile, template, MAXNAMLEN );
+#if defined(NAME_MAX)
+    (void *)strncpy( tfile, template, NAME_MAX );
+#else
+    (void *)strncpy( tfile, template, MAXNAMLEN );
+#endif
     if (( *tfd = mkstemp( tfile )) == -1 ) {
        fprintf( stderr, "can't create temporary file %s\n", tfile );
        filecleanup( -1, -1, "" );
@@ -241,7 +246,7 @@ readps(int inputfd, int tempfd, char *tempfile)
 {
     off_t              ccread = 0;
     off_t              ccmatch;
-    char               *curtok = 0;
+    char               *curtok = NULL;
     FILE               *tempstream;
     pa_buf_t           *pb;
     int                        n;
@@ -494,7 +499,11 @@ psorder(char *path)
 {
     int                        tempfd;
     int                        inputfd;
+#if defined(NAME_MAX)
+    char               tempfile[NAME_MAX];
+#else
     char               tempfile[MAXNAMLEN];
+#endif
 
     filesetup( path, &inputfd, tempfile, &tempfd );
     readps( inputfd, tempfd, tempfile );