- chmod(path,(sb.st_mode&0x0FFFF)| S_IRGRP| S_IROTH);
- if (chown(adpath, sb.st_uid, sb.st_gid)==-1)
- syslog (LOG_ERR, "Error changing AppleDouble permissions: %m");
- syslog (LOG_INFO, "Changing afpd owner back to %d", uid);
+ stat(upath, &st);
+ if (chmod(path,(st.st_mode&0x0FFFF)| S_IRGRP| S_IROTH) < 0)
+ {
+ syslog (LOG_ERR, "Error adding file read permissions: %m");
+ return (-1);
+ }
+ else syslog (LOG_DEBUG, "Added S_IRGRP and S_IROTH: %m");
+ if (chown(adpath, sb.st_uid, sb.st_gid) < 0)
+ {
+ syslog (LOG_ERR, "Error changing AppleDouble owner/gid: %m");
+ return (-1);
+ }
+ if (chmod(adpath,(st.st_mode&0x0FFFF)| S_IRGRP| S_IROTH) < 0)
+ {
+ syslog (LOG_ERR, "Error adding AD file read permissions: %m");
+ return (-1);
+ }
+ else syslog (LOG_DEBUG, "Added S_IRGRP and S_IROTH to AD: %m");
+ syslog (LOG_DEBUG, "Changing afpd owner back to %d", uid);