Skip to content

Commit

Permalink
PLXCOMP-196: Ignore unset dir/file modes in PlexusIoFileResourceColle…
Browse files Browse the repository at this point in the history
…ction

Only consider the mode that has been set and ignore the other,
to avoid treating -1 as 'all permissions'.
  • Loading branch information
josephw committed Jan 6, 2012
1 parent be5eae5 commit 24f512f
Showing 1 changed file with 17 additions and 5 deletions.
Expand Up @@ -67,19 +67,31 @@ public PlexusIoFileResourceCollection( Logger logger )
public void setDefaultAttributes( int uid, String userName, int gid, String groupName, int fileMode, int dirMode )
{
defaultFileAttributes = new FileAttributes( uid, userName, gid, groupName, new char[]{} );
defaultFileAttributes.setOctalMode( fileMode );
if ( fileMode >= 0 )
{
defaultFileAttributes.setOctalMode( fileMode );
}

defaultDirAttributes = new FileAttributes( uid, userName, gid, groupName, new char[]{} );
defaultDirAttributes.setOctalMode( dirMode );
if ( dirMode >= 0 )
{
defaultDirAttributes.setOctalMode( dirMode );
}
}

public void setOverrideAttributes( int uid, String userName, int gid, String groupName, int fileMode, int dirMode )
{
overrideFileAttributes = new FileAttributes( uid, userName, gid, groupName, new char[]{} );
overrideFileAttributes.setOctalMode( fileMode );
if ( fileMode >= 0 )
{
overrideFileAttributes.setOctalMode( fileMode );
}

overrideDirAttributes = new FileAttributes( uid, userName, gid, groupName, new char[]{} );
overrideDirAttributes.setOctalMode( dirMode );
if ( dirMode >= 0 )
{
overrideDirAttributes.setOctalMode( dirMode );
}
}

/**
Expand Down Expand Up @@ -187,4 +199,4 @@ public Iterator<PlexusIoResource> getResources() throws IOException
addResources( result, files, attributesByPath );
return result.iterator();
}
}
}

0 comments on commit 24f512f

Please sign in to comment.