+/**
+ * \fn int VFS_GetACL(int FD, tVFS_ACL *Dest)
+ */
+int VFS_GetACL(int FD, tVFS_ACL *Dest)
+{
+ int i;
+ tVFS_Handle *h = VFS_GetHandle(FD);
+
+ // Error check
+ if(!h) {
+ return -1;
+ }
+
+ // Root can do anything
+ if(Dest->Group == 0 && Dest->ID == 0) {
+ Dest->Inv = 0;
+ Dest->Perms = -1;
+ return 1;
+ }
+
+ // Root only file?, fast return
+ if( h->Node->NumACLs == 0 ) {
+ Dest->Inv = 0;
+ Dest->Perms = 0;
+ return 0;
+ }
+
+ // Check Deny Permissions
+ for(i=0;i<h->Node->NumACLs;i++)
+ {
+ if(h->Node->ACLs[i].Group != Dest->Group) continue;
+ if(h->Node->ACLs[i].ID != Dest->ID) continue;
+
+ Dest->Inv = h->Node->ACLs[i].Inv;
+ Dest->Perms = h->Node->ACLs[i].Perms;
+ return 1;
+ }
+
+
+ Dest->Inv = 0;
+ Dest->Perms = 0;
+ return 0;
+}