chmod:No such file or directory

  sprintf(fname, "core.%d", pid);
  (void) unlink(fname);
  if (ttrace(TT_PROC_CORE, pid, 0, 0, 0, 0) != 0) {
    perror("TT_PROC_CORE pass");
    Fail();
  }
  if (chmod(fname, 0) != 0) {
    perror("chmod");
    Fail();
  }

Hi,

If i execute above code,everytime am getting below error..

===============
STANDARD OUTPUT:
FAIL
STANDARD ERROR:
chmod: No such file or directory

Could you please let me know how to overcome that issue..
Is there anything wrong in the code..

Thanks in Advance,
Mansa

You are unlinking the file just a few lines above, I wouldn't be surprised that it's not there when you try and chmod it...