- Timestamp:
- Jan 1, 2006, 11:58:26 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/sh_unix.h
r1 r10 109 109 mode_t mode; 110 110 nlink_t hardlinks; 111 #if defined(__linux__) 111 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 112 112 unsigned long attributes; 113 113 char c_attributes[16]; -
trunk/src/sh_hash.c
r8 r10 338 338 { 339 339 file_type * theFile; 340 #if defined(__linux__) 340 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 341 341 int i = 16; 342 342 #endif … … 348 348 sl_strlcpy(theFile->c_mode, p->theFile.c_mode, 11); 349 349 theFile->mode = p->theFile.mode; 350 #if defined(__linux__) 350 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 351 351 sl_strlcpy(theFile->c_attributes, p->theFile.c_attributes, i /* 16 */); 352 352 theFile->attributes = p->theFile.attributes; … … 889 889 swap_32(&(ft.owner)); 890 890 swap_32(&(ft.group)); 891 #if defined(__linux__) 891 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 892 892 swap_32(&(ft.attributes)); 893 893 #endif … … 962 962 sh_do_decode(fullpath, sl_strlen(fullpath)); 963 963 964 #if defined(__linux__) 964 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 965 965 sh_do_decode(ft.c_attributes, sl_strlen(ft.c_attributes)); 966 966 #endif … … 1322 1322 char * timep; 1323 1323 1324 #if !defined(__linux__) 1324 #if !defined(__linux__) && !defined(HAVE_STAT_FLAGS) 1325 1325 int i; 1326 1326 #endif … … 1524 1524 sl_strlcpy(p.checksum, fileHash, KEY_LEN+1); 1525 1525 } 1526 #if defined(__linux__) 1526 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 1527 1527 sl_strlcpy(p.c_attributes, buf->c_attributes, 13); 1528 1528 #else … … 1540 1540 #endif 1541 1541 1542 #if defined(__linux__) 1542 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 1543 1543 p.attributes = (UINT32) buf->attributes; 1544 1544 #else … … 1986 1986 sl_strlcpy(p.c_owner, buf->c_owner, USER_MAX+1); 1987 1987 sl_strlcpy(p.checksum, fileHash, KEY_LEN+1); 1988 #if defined(__linux__) 1988 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 1989 1989 sl_strlcpy(p.c_attributes, buf->c_attributes, 13); 1990 1990 #endif 1991 1991 1992 #if defined(__linux__) 1992 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 1993 1993 p.attributes = (UINT32) buf->attributes; 1994 1994 #endif … … 2096 2096 2097 2097 2098 #if defined(__linux__) 2098 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 2099 2099 if (is_new) 2100 2100 format = _("mode_new=\"%s\" attr_new=\"%s\" imode_new=\"%ld\" iattr_new=\"%ld\" "); … … 2233 2233 2234 2234 2235 #if defined(__linux__) 2235 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 2236 2236 if (is_new) 2237 2237 format = _("mode_new=<%s>, attr_new=<%s>, imode_new=<%ld>, iattr_new=<%ld>, "); … … 2550 2550 2551 2551 if ( ( (theFile->mode != p->theFile.mode) 2552 #if defined(__linux__) 2552 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 2553 2553 || (theFile->attributes != p->theFile.attributes) 2554 2554 #endif … … 2660 2660 ) 2661 2661 { 2662 #if defined(__linux__) 2662 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 2663 2663 sl_snprintf(tmp, SH_BUFSIZE, 2664 2664 #ifdef SH_USE_XML … … 2700 2700 sl_strlcpy(p->theFile.c_mode, theFile->c_mode, 11); 2701 2701 p->theFile.mode = theFile->mode; 2702 #if defined(__linux__) 2702 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 2703 2703 sl_strlcpy(p->theFile.c_attributes,theFile->c_attributes,16); 2704 2704 p->theFile.attributes = theFile->attributes; … … 2956 2956 sl_strlcpy(theFile->c_mode, p->theFile.c_mode, 11); 2957 2957 theFile->mode = p->theFile.mode; 2958 #if defined(__linux__) 2958 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 2959 2959 sl_strlcpy(theFile->c_attributes, p->theFile.c_attributes, 16); 2960 2960 theFile->attributes = p->theFile.attributes; … … 3000 3000 sl_strlcpy(p->theFile.c_mode, theFile->c_mode, 11); 3001 3001 p->theFile.mode = theFile->mode; 3002 #if defined(__linux__) 3002 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 3003 3003 sl_strlcpy(p->theFile.c_attributes, theFile->c_attributes, 16); 3004 3004 p->theFile.attributes = theFile->attributes; -
trunk/src/sh_unix.c
r8 r10 2363 2363 **************************************************************/ 2364 2364 2365 #if defined(__linux__)2366 2367 #if defined( HAVE_LINUX_EXT2_FS_H) || defined(HAVE_EXT2FS_EXT2_FS_H)2365 #if (defined(__linux__) && (defined(HAVE_LINUX_EXT2_FS_H) || defined(HAVE_EXT2FS_EXT2_FS_H))) || defined(HAVE_STAT_FLAGS) 2366 2367 #if defined(__linux__) 2368 2368 2369 2369 /* --- Determine ext2fs file attributes. --- … … 2376 2376 #endif 2377 2377 2378 /* __linux__ includes */ 2379 #endif 2380 2378 2381 static 2379 2382 int sh_unix_getinfo_attr (char * name, 2380 2383 unsigned long * flags, 2381 2384 char * c_attr, 2382 int fd )2385 int fd, struct stat * buf) 2383 2386 { 2384 2387 … … 2396 2399 2397 2400 #ifdef HAVE_STAT_FLAGS 2398 struct stat buf;2399 int i;2400 2401 2401 2402 SL_ENTER(_("sh_unix_getinfo_attr")); … … 2403 2404 *flags = 0; 2404 2405 2405 i = retry_stat (FIL__, __LINE__, name, &buf); 2406 2407 if (i == -1) 2408 SL_RETURN(-1, _("sh_unix_getinfo_attr")); 2409 2406 /* cast to void to avoid compiler warning about unused parameters */ 2407 (void) fd; 2408 (void) name; 2409 2410 #ifdef UF_NODUMP 2411 if (buf->st_flags & UF_NODUMP) { 2412 *flags |= UF_NODUMP; 2413 c_attr[0] = 'd'; 2414 } 2415 #endif 2410 2416 #ifdef UF_IMMUTABLE 2411 if (buf.st_flags & UF_IMMUTABLE) 2412 *flags |= EXT2_IMMUTABLE_FL; 2417 if (buf->st_flags & UF_IMMUTABLE) { 2418 *flags |= UF_IMMUTABLE; 2419 c_attr[1] = 'i'; 2420 } 2413 2421 #endif 2414 2422 #ifdef UF_APPEND 2415 if (buf.st_flags & UF_APPEND) 2416 *flags |= EXT2_APPEND_FL; 2417 #endif 2418 #ifdef UF_NODUMP 2419 if (buf.st_flags & UF_NODUMP) 2420 *flags |= EXT2_NODUMP_FL; 2421 #endif 2422 2423 if (buf->st_flags & UF_APPEND) { 2424 *flags |= UF_APPEND; 2425 c_attr[2] = 'a'; 2426 } 2427 #endif 2428 #ifdef UF_NOUNLINK 2429 if (buf->st_flags & UF_NOUNLINK) { 2430 *flags |= UF_NOUNLINK; 2431 c_attr[3] = 'u'; 2432 } 2433 #endif 2434 #ifdef UF_OPAQUE 2435 if (buf->st_flags & UF_OPAQUE) { 2436 *flags |= UF_OPAQUE; 2437 c_attr[4] = 'o'; 2438 } 2439 #endif 2440 #ifdef SF_ARCHIVED 2441 if (buf->st_flags & SF_ARCHIVED) { 2442 *flags |= SF_ARCHIVED; 2443 c_attr[5] = 'R'; 2444 } 2445 2446 #endif 2447 #ifdef SF_IMMUTABLE 2448 if (buf->st_flags & SF_IMMUTABLE) { 2449 *flags |= SF_IMMUTABLE; 2450 c_attr[6] = 'I'; 2451 } 2452 #endif 2453 #ifdef SF_APPEND 2454 if (buf->st_flags & SF_APPEND) { 2455 *flags |= SF_APPEND; 2456 c_attr[7] = 'A'; 2457 } 2458 #endif 2459 #ifdef SF_NOUNLINK 2460 if (buf->st_flags & SF_NOUNLINK) { 2461 *flags |= SF_NOUNLINK; 2462 c_attr[8] = 'U'; 2463 } 2464 #endif 2465 2466 /* ! HAVE_STAT_FLAGS */ 2423 2467 #else 2424 2468 … … 2429 2473 2430 2474 *flags = 0; 2475 (void) buf; 2431 2476 2432 2477 /* open() -> aud_open() R.Wichmann … … 2444 2489 SL_RETURN(-1, _("sh_unix_getinfo_attr")); 2445 2490 2491 if (f == 0) 2492 SL_RETURN(0, _("sh_unix_getinfo_attr")); 2493 2446 2494 *flags = f; 2447 2495 … … 2455 2503 /* ! HAVE_EXT2_IOCTLS */ 2456 2504 #endif 2457 #endif2458 2505 /* 2459 2506 * END … … 2462 2509 */ 2463 2510 2511 if (*flags == 0) 2512 goto theend; 2513 2464 2514 #ifdef EXT2_SECRM_FL 2465 2515 if ( (*flags & EXT2_SECRM_FL) != 0 ) c_attr[0] = 's'; … … 2486 2536 if ( (*flags & EXT2_COMPR_FL) != 0 ) c_attr[7] = 'c'; 2487 2537 #endif 2488 #ifdef EXT2_COMPRBLK_FL 2489 if ( (*flags & EXT2_COMPRBLK_FL) != 0) c_attr[8] = 'B'; 2490 #endif 2491 #ifdef EXT2_DIRTY_FL 2492 if ( (*flags & EXT2_DIRTY_FL) != 0 ) c_attr[9] = 'D'; 2493 #endif 2494 #ifdef EXT2_NOCOMPR_FL 2495 if ( (*flags & EXT2_NOCOMPR_FL) != 0 ) c_attr[10] = 'D'; 2496 #endif 2497 #ifdef EXT2_ECOMPR_FL 2498 if ( (*flags & EXT2_ECOMPR_FL) != 0 ) c_attr[11] = 'D'; 2538 2539 #ifdef EXT2_TOPDIR_FL 2540 if ( (*flags & EXT2_TOPDIR_FL) != 0 ) c_attr[8] = 'T'; 2541 #endif 2542 #ifdef EXT2_DIRSYNC_FL 2543 if ( (*flags & EXT2_DIRSYNC_FL) != 0 ) c_attr[9] = 'D'; 2544 #endif 2545 #ifdef EXT2_NOTAIL_FL 2546 if ( (*flags & EXT2_NOTAIL_FL) != 0 ) c_attr[10] = 't'; 2547 #endif 2548 #ifdef EXT2_JOURNAL_DATA_FL 2549 if ( (*flags & EXT2_JOURNAL_DATA_FL) != 0) c_attr[11] = 'j'; 2550 #endif 2551 2552 theend: 2553 /* ext2 */ 2499 2554 #endif 2500 2555 … … 2508 2563 unsigned long * flags, 2509 2564 char * c_attr, 2510 int fd )2565 int fd, struct stat * buf) 2511 2566 { 2512 2567 return 0; 2513 2568 } 2514 #endif 2515 2516 /* __LINUX__ */ 2569 2570 /* defined(__linux__) || defined(HAVE_STAT_FLAGS) */ 2517 2571 #endif 2518 2572 … … 2908 2962 theFile->type = type; 2909 2963 2910 #if defined(__linux__) 2964 #if defined(__linux__) || defined(HAVE_STAT_FLAGS) 2911 2965 2912 2966 /* --- Determine file attributes. --- … … 2919 2973 theFile->c_mode[0] != 'l' ) 2920 2974 sh_unix_getinfo_attr(theFile->fullpath, 2921 &theFile->attributes, theFile->c_attributes, fd);2922 2975 &theFile->attributes, theFile->c_attributes, 2976 fd, &buf); 2923 2977 #endif 2924 2978
Note:
See TracChangeset
for help on using the changeset viewer.