title: chdir not working in unix under c code always failing to change directory
body: <p>I am working on an ftp server in C under unix, I am having trouble implementing the change working directory function, I already have <code>&lt;unistd.h&gt;</code> included what do you think the problem is?</p>
  
  <pre><code>static int cwd(int ctrlfd, char *cmdline) {
  
      printf("cmdline:%s\n", cmdline);
  
  
      char *space = strtok(cmdline, " \n");
      printf("cwd to :%s\n", cmdline);
  
      if (chdir(space) == 0) {
          getcwd(space, sizeof(space));
          printf("changing directory successful %s\n", space);
          return ftp_send_resp(ctrlfd, 250); 
      } else {
          printf("changing directory failed\n");
          return ftp_send_resp(ctrlfd, 550);
      }
  }
  </code></pre>