Changeset 10 for trunk/src/sh_unix.c
- Timestamp:
- Jan 1, 2006, 11:58:26 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.