Changeset 367 for trunk/src/sh_unix.c
- Timestamp:
- Oct 30, 2011, 9:18:31 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_unix.c
r362 r367 3585 3585 #endif 3586 3586 3587 3588 static void * sh_dummy_filename; 3589 static void * sh_dummy_tmp; 3590 static void * sh_dummy_tmp2; 3591 3587 3592 int sh_unix_getinfo (int level, char * filename, file_type * theFile, 3588 3593 char * fileHash, int policy) … … 3593 3598 struct stat lbuf; 3594 3599 struct stat fbuf; 3595 intstat_return;3596 intstat_errno = 0;3600 volatile int stat_return; 3601 volatile int stat_errno = 0; 3597 3602 3598 3603 ShFileType type; … … 3602 3607 3603 3608 char * linknamebuf; 3604 intlinksize;3609 volatile int linksize; 3605 3610 3606 3611 extern int get_the_fd (SL_TICKET ticket); 3607 3612 3608 SL_TICKET rval_open;3609 int err_open = 0;3610 3611 int fd;3612 int fstat_return;3613 int fstat_errno = 0;3614 int try = 0;3613 volatile SL_TICKET rval_open; 3614 volatile int err_open = 0; 3615 3616 volatile int fd; 3617 volatile int fstat_return; 3618 volatile int fstat_errno = 0; 3619 volatile int try = 0; 3615 3620 3616 3621 sh_string * content = NULL; … … 3622 3627 char * path = NULL; 3623 3628 3624 int alert_timeout = 120;3629 volatile int alert_timeout = 120; 3625 3630 3626 3631 path = theFile->fullpath; 3627 3632 3628 3633 SL_ENTER(_("sh_unix_getinfo")); 3634 3635 /* Take the address to keep gcc from putting it into a register. 3636 * Avoids the 'clobbered by longjmp' warning. 3637 */ 3638 sh_dummy_filename = (void *) &filename; 3639 sh_dummy_tmp = (void *) &tmp; 3640 sh_dummy_tmp2 = (void *) &tmp2; 3629 3641 3630 3642 /* --- Stat the file, and get checksum. --- … … 3656 3668 if (stale) 3657 3669 { 3670 SH_MUTEX_LOCK(mutex_thread_nolog); 3658 3671 sh_error_handle(SH_ERR_ERR, FIL__, __LINE__, err_open, MSG_E_SUBGEN, 3659 3672 stale, _("sh_unix_getinfo_open")); 3673 SH_MUTEX_UNLOCK(mutex_thread_nolog); 3660 3674 } 3661 3675 … … 3688 3702 { 3689 3703 tmp2 = sh_util_safe_name (theFile->fullpath); 3704 SH_MUTEX_LOCK(mutex_thread_nolog); 3690 3705 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_FI_TOOLATE, 3691 3706 (long)(tend - tstart), tmp2); 3707 SH_MUTEX_UNLOCK(mutex_thread_nolog); 3692 3708 SH_FREE(tmp2); 3693 3709 } … … 3707 3723 if (stale) 3708 3724 { 3725 SH_MUTEX_LOCK(mutex_thread_nolog); 3709 3726 sh_error_handle(SH_ERR_ERR, FIL__, __LINE__, fstat_errno, 3710 3727 MSG_E_SUBGEN, 3711 3728 stale, _("sh_unix_getinfo_fstat")); 3729 SH_MUTEX_UNLOCK(mutex_thread_nolog); 3712 3730 } 3713 3731 … … 3742 3760 (void) sl_get_euid(&euid); 3743 3761 tmp2 = sh_util_safe_name (theFile->fullpath); 3762 SH_MUTEX_LOCK(mutex_thread_nolog); 3744 3763 sh_error_handle (level, FIL__, __LINE__, stat_return, MSG_FI_STAT, 3745 3764 _("lstat"), … … 3747 3766 (long) euid, 3748 3767 tmp2); 3768 SH_MUTEX_UNLOCK(mutex_thread_nolog); 3749 3769 SH_FREE(tmp2); 3750 3770 } … … 3894 3914 (void) sl_get_euid(&euid); 3895 3915 3916 SH_MUTEX_LOCK(mutex_thread_nolog); 3896 3917 sh_error_handle (level, FIL__, __LINE__, stat_return, MSG_FI_STAT, 3897 3918 _("fstat"), … … 3899 3920 (long) euid, 3900 3921 tmp2); 3922 SH_MUTEX_UNLOCK(mutex_thread_nolog); 3901 3923 } 3902 3924 else if (fd >= 0 && !S_ISREG(fbuf.st_mode)) 3903 3925 { 3926 SH_MUTEX_LOCK(mutex_thread_nolog); 3904 3927 sh_error_handle (level, FIL__, __LINE__, fstat_errno, 3905 3928 MSG_E_NOTREG, tmp2); 3929 SH_MUTEX_UNLOCK(mutex_thread_nolog); 3906 3930 } 3907 3931 else … … 3911 3935 sl_strlcpy(errbuf, sl_error_string(rval_open), sizeof(errbuf)); 3912 3936 sh_error_message(err_open, errbuf2, sizeof(errbuf2)); 3937 SH_MUTEX_LOCK(mutex_thread_nolog); 3913 3938 sh_error_handle (level, FIL__, __LINE__, err_open, 3914 3939 MSG_E_READ, errbuf, errbuf2, tmp2); 3940 SH_MUTEX_UNLOCK(mutex_thread_nolog); 3915 3941 } 3916 3942 SH_FREE(tmp2); … … 4004 4030 if (policy == SH_LEVEL_ALLIGNORE) 4005 4031 { 4032 SH_MUTEX_LOCK(mutex_thread_nolog); 4006 4033 sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, ENOENT, 4007 4034 MSG_FI_NOGRP, 4008 4035 (long) buf.st_gid, tmp2); 4036 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4009 4037 } 4010 4038 else 4011 4039 { 4040 SH_MUTEX_LOCK(mutex_thread_nolog); 4012 4041 sh_error_handle (ShDFLevel[SH_ERR_T_NAME], FIL__, __LINE__, ENOENT, 4013 4042 MSG_FI_NOGRP, 4014 4043 (long) buf.st_gid, tmp2); 4044 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4015 4045 } 4016 4046 SH_FREE(tmp2); … … 4025 4055 if (policy == SH_LEVEL_ALLIGNORE) 4026 4056 { 4057 SH_MUTEX_LOCK(mutex_thread_nolog); 4027 4058 sh_error_handle (SH_ERR_ALL, FIL__, __LINE__, ENOENT, 4028 4059 MSG_FI_NOUSR, 4029 4060 (long) buf.st_uid, tmp2); 4061 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4030 4062 } 4031 4063 else 4032 4064 { 4065 SH_MUTEX_LOCK(mutex_thread_nolog); 4033 4066 sh_error_handle (ShDFLevel[SH_ERR_T_NAME], FIL__, __LINE__, ENOENT, 4034 4067 MSG_FI_NOUSR, 4035 4068 (long) buf.st_uid, tmp2); 4069 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4036 4070 } 4037 4071 SH_FREE(tmp2); … … 4046 4080 theFile->fullpath : filename); 4047 4081 (void) sh_unix_time(theFile->mtime, timestr, sizeof(timestr)); 4082 SH_MUTEX_LOCK(mutex_thread_nolog); 4048 4083 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_FI_LIST, 4049 4084 theFile->c_mode, … … 4054 4089 timestr, 4055 4090 tmp2); 4091 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4056 4092 SH_FREE(tmp2); 4057 4093 } … … 4076 4112 linksize = errno; 4077 4113 tmp2 = sh_util_safe_name (theFile->fullpath); 4114 SH_MUTEX_LOCK(mutex_thread_nolog); 4078 4115 sh_error_handle (level, FIL__, __LINE__, linksize, MSG_FI_RDLNK, 4079 4116 sh_error_message (linksize, errbuf, sizeof(errbuf)), tmp2); 4117 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4080 4118 SH_FREE(tmp2); 4081 4119 SH_FREE(linknamebuf); … … 4130 4168 4131 4169 (void) sl_get_euid(&euid); 4170 SH_MUTEX_LOCK(mutex_thread_nolog); 4132 4171 sh_error_handle (level, FIL__, __LINE__, stat_return, 4133 4172 MSG_FI_STAT, … … 4136 4175 (long) euid, 4137 4176 tmp2); 4177 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4138 4178 } 4139 4179 else … … 4141 4181 /* a dangling link -- everybody seems to have plenty of them 4142 4182 */ 4183 SH_MUTEX_LOCK(mutex_thread_nolog); 4143 4184 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_FI_DLNK, 4144 4185 tmp, tmp2); 4186 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4145 4187 } 4146 4188 theFile->linkisok = BAD; … … 4175 4217 { 4176 4218 tmp2 = sh_util_safe_name (linknamebuf); 4219 SH_MUTEX_LOCK(mutex_thread_nolog); 4177 4220 sh_error_handle ((-1), FIL__, __LINE__, 0, MSG_FI_LLNK, 4178 4221 theFile->link_c_mode, tmp2); 4222 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4179 4223 SH_FREE(tmp2); 4180 4224 } … … 4213 4257 _("compressed file too large (%lu bytes)"), 4214 4258 clen); 4259 SH_MUTEX_LOCK(mutex_thread_nolog); 4215 4260 sh_error_handle (SH_ERR_WARN, FIL__, __LINE__, -1, 4216 4261 MSG_E_SUBGPATH, tmsg, 4217 4262 _("sh_unix_getinfo"), tpath); 4263 SH_MUTEX_UNLOCK(mutex_thread_nolog); 4218 4264 SH_FREE(tpath); 4219 4265 }
Note:
See TracChangeset
for help on using the changeset viewer.