Blob Blame History Raw
--- xen-4.6.1/tools/libfsimage/common/fsimage_plugin.c.orig	2016-02-09 14:44:19.000000000 +0000
+++ xen-4.6.1/tools/libfsimage/common/fsimage_plugin.c	2016-03-28 20:22:39.943920923 +0100
@@ -122,7 +122,6 @@
 static int load_plugins(void)
 {
 	const char *fsdir = getenv("FSIMAGE_FSDIR");
-	struct dirent *dp = NULL;
 	struct dirent *dpp;
 	DIR *dir = NULL;
 	char *tmp = NULL;
@@ -139,15 +138,10 @@
 	if ((tmp = malloc(name_max + 1)) == NULL)
 		goto fail;
 
-	if ((dp = malloc(sizeof (struct dirent) + name_max + 1)) == NULL)
-		goto fail;
-
 	if ((dir = opendir(fsdir)) == NULL)
 		goto fail;
 
-	bzero(dp, sizeof (struct dirent) + name_max + 1);
-
-	while (readdir_r(dir, dp, &dpp) == 0 && dpp != NULL) {
+	while ((dpp = readdir(dir)) != NULL) {
 		if (strcmp(dpp->d_name, ".") == 0)
 			continue;
 		if (strcmp(dpp->d_name, "..") == 0)
@@ -167,7 +161,6 @@
 	if (dir != NULL)
 		(void) closedir(dir);
 	free(tmp);
-	free(dp);
 	errno = err;
 	return (ret);
 }
--- xen-4.6.1/tools/libxl/libxl_utils.c.orig	2016-02-09 14:44:19.000000000 +0000
+++ xen-4.6.1/tools/libxl/libxl_utils.c	2016-03-28 20:42:48.893044921 +0100
@@ -471,18 +471,10 @@
         goto out;
     }
 
-    size_t need = offsetof(struct dirent, d_name) +
-        pathconf(dirpath, _PC_NAME_MAX) + 1;
-    struct dirent *de_buf = libxl__zalloc(gc, need);
     struct dirent *de;
 
     for (;;) {
-        int r = readdir_r(d, de_buf, &de);
-        if (r) {
-            LOGE(ERROR, "failed to readdir %s for removal", dirpath);
-            rc = ERROR_FAIL;
-            break;
-        }
+        de = readdir(d);
         if (!de)
             break;