Added -mno-red-zone
[tpg/acess2.git] / Modules / IPStack / main.c
index 9b132ec..da7441c 100644 (file)
@@ -97,7 +97,7 @@ int IPStack_Install(char **Arguments)
  */
 int IPStack_AddFile(tSocketFile *File)
 {
-       Log("IPStack_AddFile: %s", File->Name);
+       Log_Log("IPStack", "Added file '%s'", File->Name);
        File->Next = gIP_FileTemplates;
        gIP_FileTemplates = File;
        return 0;
@@ -122,6 +122,11 @@ char *IPStack_Root_ReadDir(tVFS_Node *Node, int Pos)
        }
        
        name = malloc(4);
+       if(!name) {
+               Log_Warning("IPStack", "IPStack_Root_ReadDir - malloc error");
+               LEAVE('n');
+               return NULL;
+       }
        
        // Create the name
        Pos = iface->Node.ImplInt;
@@ -231,7 +236,6 @@ char *IPStack_Iface_ReadDir(tVFS_Node *Node, int Pos)
 {
        tSocketFile     *file = gIP_FileTemplates;
        while(Pos-- && file) {
-               Log("IPStack_Iface_ReadDir: %s", file->Name);
                file = file->Next;
        }
        
@@ -251,7 +255,6 @@ tVFS_Node *IPStack_Iface_FindDir(tVFS_Node *Node, char *Name)
        for(;file;file = file->Next)
        {
                if( strcmp(file->Name, Name) == 0 )     break;
-               Log("IPStack_Iface_FindDir: strcmp('%s', '%s')", file->Name, Name);
        }
        if(!file)       return NULL;
        
@@ -513,9 +516,12 @@ int IPStack_Iface_IOCtl(tVFS_Node *Node, int ID, void *Data)
 int IPStack_AddInterface(char *Device)
 {
        tInterface      *iface;
+       tAdapter        *card;
        
        ENTER("sDevice", Device);
        
+       card = IPStack_GetAdapter(Device);
+       
        iface = malloc(sizeof(tInterface));
        if(!iface) {
                LEAVE('i', -2);
@@ -527,7 +533,6 @@ int IPStack_AddInterface(char *Device)
        
        // Create Node
        iface->Node.ImplPtr = iface;
-       iface->Node.ImplInt = giIP_NextIfaceId++;
        iface->Node.Flags = VFS_FFLAG_DIRECTORY;
        iface->Node.Size = -1;
        iface->Node.NumACLs = 1;
@@ -535,6 +540,10 @@ int IPStack_AddInterface(char *Device)
        iface->Node.ReadDir = IPStack_Iface_ReadDir;
        iface->Node.FindDir = IPStack_Iface_FindDir;
        iface->Node.IOCtl = IPStack_Iface_IOCtl;
+       iface->Node.MkNod = NULL;
+       iface->Node.Link = NULL;
+       iface->Node.Relink = NULL;
+       iface->Node.Close = NULL;
        
        // Set Defaults
        iface->TimeoutDelay = DEFAULT_TIMEOUT;
@@ -547,6 +556,10 @@ int IPStack_AddInterface(char *Device)
                return -1;      // Return ERR_YOUFAIL
        }
        
+       // Delay setting ImplInt until after the adapter is opened
+       // Keeps things simple
+       iface->Node.ImplInt = giIP_NextIfaceId++;
+       
        // Append to list
        LOCK( &glIP_Interfaces );
        if( gIP_Interfaces ) {

UCC git Repository :: git.ucc.asn.au