-/* Be careful about trying to compile over running programs (parallel make) */
-static char *compile_info(const void *ctx, const char *dir, const char *name)
-{
- char *infofile = talloc_asprintf(ctx, "%s/info.%u", dir, getpid());
- char *cmd = talloc_asprintf(ctx, "cc " CFLAGS
- " -o %s -x c %s/%s/_info",
- infofile, dir, name);
- talloc_set_destructor(infofile, unlink_info);
- if (system(cmd) != 0)
+ /* Copy it to a file with proper .c suffix. */
+ info = grab_file(ctx, talloc_asprintf(ctx, "%s/_info", dir), &len);
+ if (!info)
+ return NULL;
+
+ info_c_file = maybe_temp_file(ctx, ".c", false, "_info");
+ fd = open(info_c_file, O_WRONLY|O_CREAT|O_EXCL, 0600);
+ if (fd < 0)
+ return NULL;
+ if (!write_all(fd, info, len))