return 0;
}
+int smack_new_label_from_path(const char *path, const char *xattr,
+ const char **label)
+{
+ char *result;
+ ssize_t ret = 0;
+
+ ret = getxattr(path, xattr, NULL, 0);
+ if (ret < 0 && errno != ERANGE)
+ return -1;
+
+ result = calloc(ret + 1, 1);
+ if (result == NULL)
+ return -1;
+
+ ret = getxattr(path, xattr, result, ret);
+ if (ret < 0) {
+ free(result);
+ return -1;
+ }
+
+ *label = result;
+ return 0;
+}
+
+
int smack_set_label_for_self(const char *label)
{
int len;
int smack_new_label_from_socket(int fd, char **label);
/*!
+ * Get the label that is contained in an extended attribute.
+ * Caller is responsible of freeing the returned label.
+ *
+ * @param path path of the file
+ * @param xattr extended attribute containing the label
+ * @param label returned label
+ * @return 0 on success and negative value on failure.
+ */
+int smack_new_label_from_path(const char *path, const char *xattr,
+ const char **label);
+
+/*!
* Set the label associated with the callers process.
* Caller must be run by privileged user to succeed.
*