Changeset 8 for trunk/src/sh_unix.c
- Timestamp:
- Dec 31, 2005, 2:02:03 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_unix.c
r1 r8 1194 1194 setrlimit (RLIMIT_NPROC, &limits); 1195 1195 #endif 1196 #ifdef RLIMIT_MEMLOCK 1197 setrlimit (RLIMIT_MEMLOCK, &limits); 1198 #endif 1199 1200 #if !defined(SL_DEBUG) 1201 /* no core dumps 1202 */ 1203 limits.rlim_cur = 0; 1204 limits.rlim_max = 0; 1205 #ifdef RLIMIT_CORE 1206 setrlimit (RLIMIT_CORE, &limits); 1207 #endif 1208 #else 1209 #ifdef RLIMIT_CORE 1210 setrlimit (RLIMIT_CORE, &limits); 1211 #endif 1212 #endif 1213 1214 limits.rlim_cur = 1024; 1215 limits.rlim_max = 1024; 1216 1196 1217 #if defined(RLIMIT_NOFILE) 1197 1218 setrlimit (RLIMIT_NOFILE, &limits); … … 1199 1220 setrlimit (RLIMIT_OFILE, &limits); 1200 1221 #endif 1201 #ifdef RLIMIT_MEMLOCK1202 setrlimit (RLIMIT_MEMLOCK, &limits);1203 #endif1204 1205 #if !defined(SL_DEBUG)1206 /* no core dumps1207 */1208 limits.rlim_cur = 0;1209 limits.rlim_max = 0;1210 #ifdef RLIMIT_CORE1211 setrlimit (RLIMIT_CORE, &limits);1212 #endif1213 #else1214 #ifdef RLIMIT_CORE1215 setrlimit (RLIMIT_CORE, &limits);1216 #endif1217 #endif1218 1219 1222 1220 1223 SL_RET0(_("sh_unix_setlimits")); … … 2696 2699 struct stat fbuf; 2697 2700 int stat_return; 2698 register int i; 2701 2699 2702 ShFileType type; 2700 2703 unsigned int mode; … … 2702 2705 char * tmp; 2703 2706 char * tmp2; 2704 /* char * p; */ 2707 2705 2708 char * linknamebuf; 2706 2709 int linksize; … … 2710 2713 SL_TICKET rval_open; 2711 2714 int fd; 2712 #if defined(__linux__)2713 int fd_2;2714 #endif2715 2715 int fstat_return; 2716 2716 … … 2738 2738 */ 2739 2739 tstart = time(NULL); 2740 2740 2741 stat_return = retry_lstat (FIL__, __LINE__, 2741 2742 path /* theFile->fullpath */, &buf); 2742 2743 2744 fd = -1; 2745 fstat_return = -1; 2746 rval_open = -1; 2747 2743 2748 if (stat_return == 0 && S_ISREG(buf.st_mode)) 2744 2749 { … … 2747 2752 alert_timeout = 120; /* this is per 8K block now ! */ 2748 2753 2749 if (path[ 0] == '/' && path[1] == 'p' && path[2] == 'r' &&2750 path[3] == 'o' && path[4] == 'c' && path[ 5] == '/')2754 if (path[1] == 'p' && path[5] == '/' && path[2] == 'r' && 2755 path[3] == 'o' && path[4] == 'c' && path[0] == '/') 2751 2756 { 2752 2757 /* seven is magic */ 2753 2758 alert_timeout = 7; 2754 2759 } 2755 } 2756 else 2757 rval_open = -1; 2758 2759 if (SL_ISERROR(rval_open)) 2760 fd = -1; 2761 else 2762 fd = get_the_fd(rval_open); 2760 2761 fd = get_the_fd(rval_open); 2762 } 2763 2763 2764 2764 tend = time(NULL); … … 2774 2774 SH_FREE(tmp2); 2775 2775 } 2776 2777 if (fd >= 0) 2778 fstat_return = retry_fstat (FIL__, __LINE__, fd, &fbuf); 2779 else 2780 fd = -1; 2776 2781 2777 if (fd >= 0)2778 {2779 fstat_return = retry_fstat (FIL__, __LINE__, fd, &fbuf);2780 }2781 else2782 {2783 fstat_return = -1;2784 fd = -1;2785 }2786 #if defined(__linux__)2787 fd_2 = fd;2788 #endif2789 2782 2790 2783 /* --- case 1: lstat failed --- … … 2809 2802 } 2810 2803 2811 /* --- case 2: not a regular file , or [IgnoreAll]---2804 /* --- case 2: not a regular file --- 2812 2805 */ 2813 2806 else if (! S_ISREG(buf.st_mode)) … … 2906 2899 /* --- Determine file type. --- 2907 2900 */ 2908 for (i = 0; i < 10; ++i) theFile->c_mode[i] = '-';2901 memset (theFile->c_mode, '-', 10); 2909 2902 theFile->c_mode[10] = '\0'; 2910 for (i = 0; i < 11; ++i) theFile->link_c_mode[i] = '-'; 2903 2904 memset (theFile->link_c_mode, '-', 10); 2911 2905 theFile->link_c_mode[10] = '\0'; 2912 2906 … … 2918 2912 /* --- Determine file attributes. --- 2919 2913 */ 2920 for (i = 0; i < 12; ++i) theFile->c_attributes[i] = '-';2914 memset (theFile->c_attributes, '-', 12); 2921 2915 theFile->c_attributes[12] = '\0'; 2922 2916 theFile->attributes = 0; … … 2925 2919 theFile->c_mode[0] != 'l' ) 2926 2920 sh_unix_getinfo_attr(theFile->fullpath, 2927 &theFile->attributes, theFile->c_attributes, fd _2);2921 &theFile->attributes, theFile->c_attributes, fd); 2928 2922 2929 2923 #endif
Note:
See TracChangeset
for help on using the changeset viewer.