- if ( *dirp->d_name == '.' ) {
- continue;
- };
- if ( stat( dirp->d_name, &st ) < 0 ) {
- syslog( LOG_ERR, "setdirowner: stat %s: %s",
- dirp->d_name, strerror(errno) );
- continue;
- }
- if (( st.st_mode & S_IFMT ) == S_IFREG ) {
- if ( chown( dirp->d_name, uid, gid ) < 0 && errno != EPERM ) {
- syslog( LOG_DEBUG, "setdirowner: chown %s: %s",
- dirp->d_name, strerror(errno) );
- /* return ( -1 ); Sometimes this is okay */
- }
- }
- }
- closedir( dir );
- if (( dir = opendir( ".AppleDouble" )) == NULL ) {
- if (noadouble)
- goto setdirowner_noadouble;
- return( -1 );
- }
- strcpy( buf, ".AppleDouble" );
- strcat( buf, "/" );
- m = strchr( buf, '\0' );
- for ( dirp = readdir( dir ); dirp != NULL; dirp = readdir( dir )) {
- if ( strcmp( dirp->d_name, "." ) == 0 ||
- strcmp( dirp->d_name, ".." ) == 0 ) {
- continue;
- }
- *m = '\0';
- strcat( buf, dirp->d_name );
- if ( chown( buf, uid, gid ) < 0 && errno != EPERM ) {
- syslog( LOG_DEBUG, "setdirowner: chown %d/%d %s: %s",
- uid, gid, buf, strerror(errno) );
- /* return ( -1 ); Sometimes this is okay */
- }
+ if ( *dirp->d_name == '.' && (!osx || dirp->d_name[1] != '_')) {
+ continue;
+ }
+ if ( lstat( dirp->d_name, &st ) < 0 ) {
+ LOG(log_error, logtype_afpd, "setdirowner: stat %s: %s",
+ fullpathname(dirp->d_name), strerror(errno) );
+ continue;
+ }
+ if (( st.st_mode & S_IFMT ) == S_IFREG ) {
+ if ( chown( dirp->d_name, uid, gid ) < 0 && errno != EPERM ) {
+ LOG(log_debug, logtype_afpd, "setdirowner: chown %s: %s",
+ fullpathname(dirp->d_name), strerror(errno) );
+ /* return ( -1 ); Sometimes this is okay */
+ }
+ }