use $(LIBENSCVECTOR) instead of libensc_vector.a
[util-vserver.git] / util-vserver / src / lsxid.c
index d6157b6..cc1f88d 100644 (file)
@@ -124,21 +124,19 @@ lookupContext(xid_t xid)
 }
 
 static xid_t
-getFileContext(char const *name, struct stat const *exp_st)
+getFileContext(char const *name)
 {
   xid_t                res;
   uint32_t     mask = VC_IATTR_XID;
   
-  if (vc_get_iattr_compat(name, exp_st->st_dev, exp_st->st_ino,
-                         &res, 0, &mask, &exp_st->st_mode)==-1)
-    perror("vc_get_iattr_compat()");
+  if (vc_get_iattr(name, &res, 0, &mask)==-1)
+    perror("vc_get_iattr()");
 
   return (mask&VC_IATTR_XID) ? res : VC_NOCTX;
 }
 
 bool
-handleFile(char const *name, char const *display_name,
-          struct stat const *exp_st)
+handleFile(char const *name, char const *display_name)
 {
   xid_t                ctx = 0;
   char         buf[MAX(sizeof(ctx)*3+1, 20)];
@@ -147,7 +145,7 @@ handleFile(char const *name, char const *display_name,
   memset(buf, ' ', sizeof buf);
 
 #if 1
-  ctx = getFileContext(name, exp_st);
+  ctx = getFileContext(name);
 #else
 #  warning Compiling in debug-code
   ctx = random() % 10 + 49213;
@@ -155,7 +153,7 @@ handleFile(char const *name, char const *display_name,
   
   if (ctx==VC_NOCTX) {
     memcpy(buf, "!!ERR!!", 7);
-    write(1, buf, sizeof buf);
+    Vwrite(1, buf, sizeof buf);
     need_write = false;
   }
   else if (global_args->do_mapping) {
@@ -163,8 +161,8 @@ handleFile(char const *name, char const *display_name,
     if (!vname) buf[0] = '\0';
     else {
       size_t           l = strlen(vname);
-      if (l<sizeof(buf)) write(1, buf, sizeof(buf)-l);
-      write(1, vname, l);
+      if (l<sizeof(buf)) Vwrite(1, buf, sizeof(buf)-l);
+      Vwrite(1, vname, l);
 
       need_write = false;
     }
@@ -172,13 +170,13 @@ handleFile(char const *name, char const *display_name,
 
   if (need_write) {
     size_t     l = utilvserver_fmt_ulong(buf, ctx);
-    if (l<sizeof(buf)) write(1, buf+l, sizeof(buf)-l);
-    write(1, buf, l);
+    if (l<sizeof(buf)) Vwrite(1, buf+l, sizeof(buf)-l);
+    Vwrite(1, buf, l);
   }
 
-  write(1, "  ", 2);
-  write(1, display_name, strlen(display_name));
-  write(1, "\n", 1);
+  Vwrite(1, "  ", 2);
+  Vwrite(1, display_name, strlen(display_name));
+  Vwrite(1, "\n", 1);
 
   return ctx!=VC_NOCTX;
 }