use 'exec-cd' instead of 'secure-umount'
[util-vserver.git] / util-vserver / lib / getvserverctx.c
index 74225fd..3052c7a 100644 (file)
 
 #include "vserver.h"
 #include "pathconfig.h"
+#include "compat-c99.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <string.h>
+#include <unistd.h>
 
 static ctx_t
 getCtxFromFile(char const *pathname)
@@ -41,18 +44,20 @@ getCtxFromFile(char const *pathname)
       (len>50) ||
       (lseek(fd, 0, SEEK_SET)==-1))
     return VC_NOCTX;
-  
-  char buf[len+1];
-  if (TEMP_FAILURE_RETRY(read(fd, buf, len+1))!=len)
-    return VC_NOCTX;
 
+  BS;
+  char         buf[len+1];
   char         *errptr;
   ctx_t                res;
+  
+  if (TEMP_FAILURE_RETRY(read(fd, buf, len+1))!=len)
+    return VC_NOCTX;
 
   res = strtol(buf, &errptr, 10);
   if (*errptr!='\0' && *errptr!='\n') return VC_NOCTX;
 
   return res;
+  BE;
 }
 
 ctx_t