]> git.cworth.org Git - fips/blobdiff - execute.c
Move metrics-tracking code from glwrap.c to new metrics.c
[fips] / execute.c
index 527b8cbabc68dd4358ef490c812ac5595aea27ff..68a60bfedf9f918cdb553f60c4a8150bbdec4946 100644 (file)
--- a/execute.c
+++ b/execute.c
  * THE SOFTWARE.
  */
 
-#include "config.h"
+#include "fips.h"
 
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <string.h>
 #include <errno.h>
 
 #include <unistd.h>
@@ -81,20 +77,20 @@ get_bin_name (void *ctx)
         * of the filename being linked to). Go figure. */
        int name_len = PATH_MAX + 1;
 
-       name = talloc_size (ctx, name_len - 1);
+       name = talloc_size (ctx, name_len);
        if (name == NULL) {
                fprintf (stderr, "Out of memory.\n");
                exit (1);
        }
 
-       name_len = readlink (link, name, name_len);
+       name_len = readlink (link, name, name_len - 1);
        if (name_len < 0) {
                fprintf (stderr, "Failed to readlink %s: %s\n", link,
                         strerror (errno));
                exit (1);
        }
 
-       name[name_len + 1] = '\0';
+       name[name_len] = '\0';
 
        return name;
 }