Index: trunk/include/sh_unix.h
===================================================================
--- trunk/include/sh_unix.h	(revision 9)
+++ trunk/include/sh_unix.h	(revision 10)
@@ -109,5 +109,5 @@
   mode_t           mode;
   nlink_t          hardlinks;
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
   unsigned long    attributes;
   char             c_attributes[16];
Index: trunk/src/sh_hash.c
===================================================================
--- trunk/src/sh_hash.c	(revision 9)
+++ trunk/src/sh_hash.c	(revision 10)
@@ -338,5 +338,5 @@
 {
   file_type * theFile;
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
   int i = 16;
 #endif
@@ -348,5 +348,5 @@
   sl_strlcpy(theFile->c_mode, p->theFile.c_mode, 11);
   theFile->mode  =  p->theFile.mode;
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
   sl_strlcpy(theFile->c_attributes, p->theFile.c_attributes, i /* 16 */);
   theFile->attributes =  p->theFile.attributes;
@@ -889,5 +889,5 @@
   swap_32(&(ft.owner));
   swap_32(&(ft.group));
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
   swap_32(&(ft.attributes));
 #endif
@@ -962,5 +962,5 @@
   sh_do_decode(fullpath,    sl_strlen(fullpath));
   
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
   sh_do_decode(ft.c_attributes,   sl_strlen(ft.c_attributes));
 #endif
@@ -1322,5 +1322,5 @@
   char * timep;
 
-#if !defined(__linux__)
+#if !defined(__linux__) && !defined(HAVE_STAT_FLAGS)
   int    i;
 #endif
@@ -1524,5 +1524,5 @@
       sl_strlcpy(p.checksum, fileHash,      KEY_LEN+1);
     }
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
     sl_strlcpy(p.c_attributes, buf->c_attributes, 13);
 #else
@@ -1540,5 +1540,5 @@
 #endif
     
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
     p.attributes  = (UINT32) buf->attributes;
 #else
@@ -1986,9 +1986,9 @@
   sl_strlcpy(p.c_owner,  buf->c_owner,  USER_MAX+1);
   sl_strlcpy(p.checksum, fileHash,      KEY_LEN+1);
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
   sl_strlcpy(p.c_attributes, buf->c_attributes, 13);
 #endif
 
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
   p.attributes  = (UINT32) buf->attributes;
 #endif
@@ -2096,5 +2096,5 @@
 
 
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
   if (is_new)
     format = _("mode_new=\"%s\" attr_new=\"%s\" imode_new=\"%ld\" iattr_new=\"%ld\" ");
@@ -2233,5 +2233,5 @@
 
 
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
   if (is_new)
     format = _("mode_new=<%s>, attr_new=<%s>, imode_new=<%ld>, iattr_new=<%ld>, ");
@@ -2550,5 +2550,5 @@
 
   if ( (  (theFile->mode != p->theFile.mode)
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
           || (theFile->attributes != p->theFile.attributes)
 #endif
@@ -2660,5 +2660,5 @@
 	     )
 	{
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
 	  sl_snprintf(tmp, SH_BUFSIZE, 
 #ifdef SH_USE_XML
@@ -2700,5 +2700,5 @@
 		  sl_strlcpy(p->theFile.c_mode, theFile->c_mode, 11);
 		  p->theFile.mode = theFile->mode;
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
 		  sl_strlcpy(p->theFile.c_attributes,theFile->c_attributes,16);
 		  p->theFile.attributes = theFile->attributes;
@@ -2956,5 +2956,5 @@
 	      sl_strlcpy(theFile->c_mode, p->theFile.c_mode, 11);
 	      theFile->mode  =  p->theFile.mode;
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
 	      sl_strlcpy(theFile->c_attributes, p->theFile.c_attributes, 16);
 	      theFile->attributes =  p->theFile.attributes;
@@ -3000,5 +3000,5 @@
 	      sl_strlcpy(p->theFile.c_mode, theFile->c_mode, 11);
 	      p->theFile.mode  =  theFile->mode;
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
 	      sl_strlcpy(p->theFile.c_attributes, theFile->c_attributes, 16);
 	      p->theFile.attributes = theFile->attributes;
Index: trunk/src/sh_unix.c
===================================================================
--- trunk/src/sh_unix.c	(revision 9)
+++ trunk/src/sh_unix.c	(revision 10)
@@ -2363,7 +2363,7 @@
  **************************************************************/
 
-#if defined(__linux__) 
-
-#if defined(HAVE_LINUX_EXT2_FS_H) || defined(HAVE_EXT2FS_EXT2_FS_H)
+#if (defined(__linux__) && (defined(HAVE_LINUX_EXT2_FS_H) || defined(HAVE_EXT2FS_EXT2_FS_H))) || defined(HAVE_STAT_FLAGS)
+
+#if defined(__linux__)
 
 /* --- Determine ext2fs file attributes. ---
@@ -2376,9 +2376,12 @@
 #endif
 
+/* __linux__ includes */
+#endif
+
 static 
 int sh_unix_getinfo_attr (char * name, 
 			  unsigned long * flags, 
 			  char * c_attr,
-			  int fd)
+			  int fd, struct stat * buf)
 {
 
@@ -2396,6 +2399,4 @@
 
 #ifdef HAVE_STAT_FLAGS
-  struct stat buf;
-  int    i;
 
   SL_ENTER(_("sh_unix_getinfo_attr"));
@@ -2403,22 +2404,65 @@
   *flags = 0;
 
-  i = retry_stat (FIL__, __LINE__, name, &buf);
-
-  if (i == -1)
-    SL_RETURN(-1, _("sh_unix_getinfo_attr"));
-
+  /* cast to void to avoid compiler warning about unused parameters */
+  (void) fd;
+  (void) name;
+
+#ifdef UF_NODUMP
+  if (buf->st_flags & UF_NODUMP) {
+    *flags |= UF_NODUMP;
+    c_attr[0] = 'd';
+  }
+#endif
 #ifdef UF_IMMUTABLE
-  if (buf.st_flags & UF_IMMUTABLE)
-    *flags |= EXT2_IMMUTABLE_FL;
+  if (buf->st_flags & UF_IMMUTABLE) {
+    *flags |= UF_IMMUTABLE;
+    c_attr[1] = 'i';
+  }
 #endif
 #ifdef UF_APPEND
-  if (buf.st_flags & UF_APPEND)
-    *flags |= EXT2_APPEND_FL;
-#endif
-#ifdef UF_NODUMP
-  if (buf.st_flags & UF_NODUMP)
-    *flags |= EXT2_NODUMP_FL;
-#endif
-
+  if (buf->st_flags & UF_APPEND) {
+    *flags |= UF_APPEND;
+    c_attr[2] = 'a';
+  }
+#endif
+#ifdef UF_NOUNLINK
+  if (buf->st_flags & UF_NOUNLINK) {
+    *flags |= UF_NOUNLINK;
+    c_attr[3] = 'u';
+  }
+#endif
+#ifdef UF_OPAQUE
+  if (buf->st_flags & UF_OPAQUE) {
+    *flags |= UF_OPAQUE;
+    c_attr[4] = 'o';
+  }
+#endif
+#ifdef SF_ARCHIVED
+  if (buf->st_flags & SF_ARCHIVED) {
+    *flags |= SF_ARCHIVED;
+    c_attr[5] = 'R';
+  }
+    
+#endif
+#ifdef SF_IMMUTABLE
+  if (buf->st_flags & SF_IMMUTABLE) {
+    *flags |= SF_IMMUTABLE;
+    c_attr[6] = 'I';
+  }
+#endif
+#ifdef SF_APPEND
+  if (buf->st_flags & SF_APPEND) {
+    *flags |= SF_APPEND;
+    c_attr[7] = 'A';
+  }
+#endif
+#ifdef SF_NOUNLINK
+  if (buf->st_flags & SF_NOUNLINK) {
+    *flags |= SF_NOUNLINK;
+    c_attr[8] = 'U';
+  }
+#endif
+
+  /* ! HAVE_STAT_FLAGS */
 #else
 
@@ -2429,4 +2473,5 @@
 
   *flags = 0;
+  (void) buf;
 
   /* open() -> aud_open() R.Wichmann 
@@ -2444,4 +2489,7 @@
     SL_RETURN(-1, _("sh_unix_getinfo_attr"));
 
+  if (f == 0)
+    SL_RETURN(0, _("sh_unix_getinfo_attr"));
+
   *flags = f;
 
@@ -2455,5 +2503,4 @@
 /* ! HAVE_EXT2_IOCTLS */
 #endif 
-#endif
 /*
  * END
@@ -2462,4 +2509,7 @@
  */
 
+  if (*flags == 0)
+    goto theend;
+
 #ifdef EXT2_SECRM_FL
   if ( (*flags & EXT2_SECRM_FL) != 0  )   c_attr[0] = 's';
@@ -2486,15 +2536,20 @@
   if ( (*flags & EXT2_COMPR_FL) != 0   )  c_attr[7] = 'c';
 #endif
-#ifdef EXT2_COMPRBLK_FL
-  if ( (*flags & EXT2_COMPRBLK_FL) != 0)  c_attr[8] = 'B';
-#endif
-#ifdef EXT2_DIRTY_FL
-  if ( (*flags & EXT2_DIRTY_FL) != 0   )  c_attr[9] = 'D';
-#endif
-#ifdef EXT2_NOCOMPR_FL
-  if ( (*flags & EXT2_NOCOMPR_FL) != 0 )  c_attr[10] = 'D';
-#endif
-#ifdef EXT2_ECOMPR_FL
-  if ( (*flags & EXT2_ECOMPR_FL) != 0  )  c_attr[11] = 'D';
+
+#ifdef EXT2_TOPDIR_FL
+  if ( (*flags & EXT2_TOPDIR_FL) != 0  )  c_attr[8] = 'T';
+#endif
+#ifdef EXT2_DIRSYNC_FL
+  if ( (*flags & EXT2_DIRSYNC_FL) != 0 )  c_attr[9] = 'D';
+#endif
+#ifdef EXT2_NOTAIL_FL
+  if ( (*flags & EXT2_NOTAIL_FL) != 0  )  c_attr[10] = 't';
+#endif
+#ifdef EXT2_JOURNAL_DATA_FL
+  if ( (*flags & EXT2_JOURNAL_DATA_FL) != 0)  c_attr[11] = 'j';
+#endif
+
+ theend:
+  /* ext2 */
 #endif
 
@@ -2508,11 +2563,10 @@
 			  unsigned long * flags, 
 			  char * c_attr,
-			  int fd)
+			  int fd, struct stat * buf)
 {
   return 0;
 }
-#endif
-
-/* __LINUX__ */
+
+/* defined(__linux__) || defined(HAVE_STAT_FLAGS) */
 #endif
 
@@ -2908,5 +2962,5 @@
   theFile->type = type;
 
-#if defined(__linux__)
+#if defined(__linux__) || defined(HAVE_STAT_FLAGS)
 
   /* --- Determine file attributes. ---
@@ -2919,6 +2973,6 @@
       theFile->c_mode[0] != 'l' )
     sh_unix_getinfo_attr(theFile->fullpath, 
-			 &theFile->attributes, theFile->c_attributes, fd);
-
+			 &theFile->attributes, theFile->c_attributes, 
+			 fd, &buf);
 #endif
 
