Thread: help with error message

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    6

    Unhappy help with error message

    I am implementing simple ftpclient and ftpserver.
    When I compile, I get the following error message, please help me to fix this.

    gcc -c ftpclient.c
    ftpclient.c:10:21: sys/conf.h: No such file or directory
    ftpclient.c: In function `get_response':
    ftpclient.c:143: warning: passing arg 4 of `recv' makes integer from pointer without a cast
    ftpclient.c:162: warning: passing arg 4 of `recv' makes integer from pointer without a cast
    ftpclient.c:166: warning: assignment makes integer from pointer without a cast
    ftpclient.c: In function `ftp_command_ls':
    ftpclient.c:351: warning: passing arg 4 of `recv' makes integer from pointer without a cast
    ftpclient.c: In function `ftp_command_get':
    ftpclient.c:450: warning: passing arg 4 of `recv' makes integer from pointer without a cast
    ftpclient.c:453: warning: passing arg 4 of `recv' makes integer from pointer without a cast
    ftpclient.c: In function `ftp_command_put':
    ftpclient.c:556: warning: passing arg 4 of `send' makes integer from pointer without a cast
    ftpclient.c: In function `ftp_command_mget':
    ftpclient.c:647: warning: passing arg 4 of `recv' makes integer from pointer without a cast
    ftpclient.c:650: warning: passing arg 4 of `recv' makes integer from pointer without a cast
    ftpclient.c:698: warning: assignment makes integer from pointer without a cast
    Last edited by ddolddolee82; 05-07-2006 at 08:49 PM.

  2. #2
    Registered User
    Join Date
    Jun 2004
    Posts
    277
    First error means you miss a lib.
    void ftp_command_ls(int control_id, char *data)
    void ftp_command_put(int control_id, char* data)
    look the types you pass agaisn the prototypes seems your call to recv misses a paramether...

  3. #3
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    Code:
    recv(control_soc, &data, sizeof(char) * BUFFER, NULL);
    recv() is: recv(int socket, void *buffer, size_t len, int flags); Using that:
    1) &data can be just "data" (data is a char array).
    2) sizeof(char) * BUFFER is correct, syntax-wise, but you won't have room to insert a null terminator should you need one.
    3) The last argument is an integer. You want to pass 0, not NULL. (Majority of your errors are this)

    Code:
    data[errorlevel] = NULL;
    First, data is a char array. You want to set it to either 0 or '\0', but not NULL. (NULL is for pointers.) Finally, you say:
    Code:
    	  errorlevel = recv(control_soc, data, sizeof(char) * BUFFER, NULL);
    	  data[errorlevel] = NULL;
    What if recv fills your buffer completely? recv() will return BUFFER * sizeof(char), and then you use that as an index, which is out of bounds. Basically re-interates my second suggestion above.

    Hope that helps. (Edit: Good indentation is a boon to error-seekers.)
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  4. #4
    Registered User
    Join Date
    Mar 2006
    Posts
    6
    Do you have any idea about
    ftpclient.c:10:21: sys/conf.h: No such file or directory
    message?
    cuz I do have it in my codes I don't understand why it says there is no such file.
    I am going to try your suggestion now.
    Thanks.

  5. #5
    Registered User
    Join Date
    Mar 2006
    Posts
    6
    Changing Null to 0 got rid of all casting erros.
    But, I still have

    gcc -c ftpclient.c
    ftpclient.c:46:21: sys/conf.h: No such file or directory
    make: *** [ftpclient.o] Error 1

    help~

  6. #6
    Registered User
    Join Date
    Jun 2004
    Posts
    277
    Quote Originally Posted by ddolddolee82
    Do you have any idea about
    ftpclient.c:10:21: sys/conf.h: No such file or directory
    message?
    cuz I do have it in my codes I don't understand why it says there is no such file.
    I am going to try your suggestion now.
    Thanks.
    As ive already said you miss this lib, wich os are you running?

  7. #7
    Registered User
    Join Date
    Mar 2006
    Posts
    6
    linux, how can I fix it then?

  8. #8
    Registered User
    Join Date
    Jun 2004
    Posts
    277
    Quote Originally Posted by ddolddolee82
    linux, how can I fix it then?
    I'm not even sure you need this lib, I don't seem to have it wich function do you call from it?

  9. #9
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    Maragato: Would a (nonstandard) library place a header file in sys/ ?

    Never heard of sys/conf.h, and I don't have it myself. (But I'm MinGW, not linux, so...) Even so: do you need it? (Why did you include it?) If it's the only error you're getting, you seem to not need it (as whatever it defines isn't used).
    Perhaps try commenting it out, and compiling?

    Code:
    void destroy_connection (socketid)
    {
      shutdown(socketid, NOW);
      close(socketid);
    }
    Does socketid have a type? Perhaps it should be specified. ;-) (Compiling with -Wall might warn you about that.) Also, your commenting says that function "takes nothing" - does that socketid not count?
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  10. #10
    Registered User
    Join Date
    Mar 2006
    Posts
    6
    Yeah, it turns out I didn't need it after all.
    I removed it and no errors.
    Thanks

  11. #11
    Registered User
    Join Date
    Jun 2004
    Posts
    277
    Quote Originally Posted by Cactus_Hugger
    Maragato: Would a (nonstandard) library place a header file in sys/ ?
    I really doubt... But I was just making sure of the assumption.

Popular pages Recent additions subscribe to a feed