0

my command line entry is
./server https://ide50-applebyoz.cs50.io/public/
I've set some printf commands to show path and root and the result is:

path: https://ide50-applebyoz.cs50.io/public/
root: (null)
Stopping server

The relevant code section is:

void start(short port, const char *path)
{
// path to server's root
root = realpath(path, NULL);
printf("path: %s \n", path); // debug
printf("root: %s \n", root); // debug
if (root == NULL)
{
stop();
}

Any suggestions? Chris A

4
  • 1
    I think you're mistaking the command line entry parameter for the program to run. I think it should be ./server ~/workspace/pset6/public
    – dLopez
    Commented Aug 6, 2016 at 1:41
  • Thanks, That was very helpful. I'd misunderstood the process. Now I can proceed with debugging and my first problem is I get a segmentation fault in my parse function. the critical lines are: <br /> Commented Aug 8, 2016 at 1:35
  • The critical lines are: <br /> char method[24];<br /> char path[LimitRequestLine + 1];<br /> char question[LimitRequestLine + 1];<br /> ... <br /> if(line[i] == '?')<br /> {<br /> ...<br /> while(line[i] != ' ') <br /> {<br /> question[j] = line[i];<br /> i = i + 1;<br /> j = j + 1;<br /> }<br /> ...<br /> strcpy(abs_path, path);<br /> printf("abs_path: %s \n", abs_path); //debug<br /> strcpy(query, question);<br /> printf("query: %s\n", query); // debug<br /> <br /> The path prints but a segmentation fault occurs before query prints. – Commented Aug 8, 2016 at 1:49
  • I've now changed the code so I'm using query instead of question and it works fine. Commented Aug 9, 2016 at 7:50

0

You must log in to answer this question.

Browse other questions tagged .