title: Can someone interpret this for me?
body: <pre><code>Program received signal SIGSEGV, Segmentation fault.
  memcpy ()
      at ../sysdeps/x86_64/multiarch/../multiarch/memmove-vec-unaligned-erms.S:143
  143 ../sysdeps/x86_64/multiarch/../multiarch/memmove-vec-unaligned-erms.S: No such file or directory.
  (gdb) bt
  #0  memcpy ()
      at ../sysdeps/x86_64/multiarch/../multiarch/memmove-vec-unaligned-erms.S:143
  #1  0x00007ffff764aa2e in __GI__IO_default_xsputn (f=0x7fffffffcf30, 
      data=&lt;optimized out&gt;, n=30) at genops.c:438
  #2  0x00007ffff761c59c in _IO_vfprintf_internal (
      s=s@entry=0x7fffffffcf30, format=&lt;optimized out&gt;, 
      format@entry=0x55555555773f "%s/%s", ap=ap@entry=0x7fffffffd058)
      at vfprintf.c:1637
  #3  0x00007ffff763e61b in __IO_vsprintf (
      string=0x3930313938393339 &lt;error: Cannot access memory at address 0x3930313938393339&gt;, format=0x55555555773f "%s/%s", 
      args=args@entry=0x7fffffffd058) at iovsprintf.c:42
  #4  0x00007ffff7623717 in __sprintf (s=&lt;optimized out&gt;, 
      format=&lt;optimized out&gt;) at sprintf.c:32
  #5  0x000055555555680e in take_action (
      hash=0x7fffffffd4d0 "4ef3065e42d1ba6d821e734b2957b264", 
      index=0x7fffffffd36c, filnamE=0x7fffffffd5d0 "fs", 
      time_s=0x7fffffffd4a0 "1493989109") at file_sync.c:652
  #6  0x0000555555556f25 in run_client (port_no=10009) at file_sync.c:821
  #7  0x00005555555571df in main (argc=3, argv=0x7fffffffdef8)
      at file_sync.c:923
  </code></pre>
  
  <p>The code I'm getting this for is:</p>
  
  <pre><code>    char *fnam;
      int nn = sprintf(fnam,"%s/%s",cwd,filnam);
      fnam[nn] = '\0';
  </code></pre>
  
  <p>where <code>cwd</code> is a string with value : <code>"/home/username/dir1/dir2/di3"</code>
  <code>filnam</code> has value : <code>fs</code></p>
  
  <p>I know these are the values because I've printed them out.</p>
  
  <p>Can someone interpret this error for me? I cant seem to figure this out. Please help me with this! Thanks!</p>
  
  <p>EDIT:</p>
  
  <p>Okay here's the declarations as asked for:</p>
  
  <pre><code>char cwd[256];
  getcwd(cwd, sizeof(cwd));
  **// getting cwd here**
  
  DIR *directory = NULL;
  pdir = opendir(cwd);
  
  if(directory ==  NULL){printf("\nDirectory bad!!\n");exit(1);}  
  char * filnam;
  struct dirent *uppp = NULL;
  while( uppp = readdir(directory) ) 
  {
      if(uppp == NULL){printf("\nproblemo. \n"); exit(1);}
      filnam = uppp-&gt;d_name;
      if(filnam[0] == '.') { continue; }
  **// this is where I'm getting filename**
  
  
  
  }
  </code></pre>