problems with cflowd-2-1-b1 on powerpc-ibm-aix4.3.3.0

From: Shvedko Pavel (shved@servocomp.ru)
Date: Fri Feb 16 2001 - 00:24:33 PST

  • Next message: Agris: "cflowd man"

    Hello all!

    Found problems in work cflowd-2-1-b1 on powerpc-ibm-aix4.3.3.0. It was incorrect call
    functions ftok and malloc for example

    classes/src/CflowdPacketQueue.cc:120 int mapsemid = semget(ftok((char
    *)name,0),2,S_IRWXU|S_IRWXG|S_IRWXO);

    Here second argument is 0. It raise error -1.
    Look at man ftok

         ...skipping
         #include <sys/types.h>

         #include <sys/ipc.h>

         key_t ftok (Path, ID)

         char *Path;

         int ID;
         ...skipping
         Return Values

         When successful, the ftok subroutine returns a key that can be passed to the
         msgget, semget, or shmget subroutine.

         Error Codes

         The ftok subroutine returns the value (key_t)-1 if one or more of the following
         are true:

           o The file named by the Path parameter does not exist.
           o The file named by the Path parameter is not accessible to the process.
           o The ID parameter has a value of 0.
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         ...skipping

    classes/src/CflowdNetMatrix.cc:155 char *buf = (char *)malloc(expectedLength);
    classes/src/CflowdNetMatrix.cc:156 if (buf == (char *)0) {

    Condition in line 156 is true when numEntries is 0
    Look at man malloc

         ...skipping
         #include <stdlib.h>

         void *malloc (Size)

         size_t Size;
         ...skipping
         Return Values

         Each of the allocation subroutines returns a pointer to space suitably aligned
         for storage of any type of object. Cast the pointer to the pointer-to-element
         type before using it.

         The malloc, realloc, calloc , and valloc subroutines return a null pointer if
         there is no available memory, or if the memory arena has been corrupted by being
         stored outside the bounds of a block. When this happens, the block pointed to by
         the Pointer parameter may be destroyed.

         If the malloc or valloc subroutine is called with a size of 0, the subroutine
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         returns a null pointer.
         ~~~~~~~~~~~~~~~~~~~~~~
         ...skipping

    Best regards !

    --
    Shvedko Pavel   phone:(095) 912-5879, 912-3604, 911-3654
    ServoComp       http://www.servocomp.ru
    

    -- cflowd mailing list cflowd@caida.org



    This archive was generated by hypermail 2b29 : Fri Feb 16 2001 - 00:43:16 PST