further locking fixes
[util-vserver.git] / util-vserver / src / save_ctxinfo.c
index 2dd49f0..03709de 100644 (file)
@@ -75,10 +75,10 @@ int main(int argc, char *argv[])
     return 255;
   }
 
-  Ereadlink(runfile, dstfile, sizeof(dstfile));
+  EreadlinkD(runfile, dstfile, sizeof(dstfile));
   len  = utilvserver_fmt_uint(buf, ctx);
 
-  fd = Eopen(dstfile, O_EXCL|O_CREAT|O_WRONLY, 0644);
+  fd = EopenD(dstfile, O_EXCL|O_CREAT|O_WRONLY, 0644);
   if (write(fd, buf,     len) !=len  ||
       write(fd, "\n",    1)   !=1) {
     perror("save_ctxinfo: write()");
@@ -87,9 +87,9 @@ int main(int argc, char *argv[])
   Eclose(fd);
 
   strcat(runfile, ".rev/");
-  strcat(runfile, buf);
+  strncat(runfile, buf, len);
   unlink(runfile);
-  Esymlink(argv[1], runfile);
+  EsymlinkD(argv[1], runfile);
 
   Eexecv(argv[2], argv+2);
 }