Svante Signell, le Thu 03 Apr 2014 12:42:06 +0200, a écrit :
> -             snprintf(pathname, sizeof(pathname), "%s/%s",
> +             len = strlen(dirname) + 1 + strlen(entry->d_name) + 1;
> +             pathname = malloc(len);
> +             if (pathname == NULL)
> +                      break;

You probably need to set err to -1 here so it's really taken as an error
below.

> @@ -736,13 +743,22 @@ found_SUNW_ctf_str:
>       if (close(fd) < 0)
>               goto out_unlink;
>  
> -     char cmd[PATH_MAX];
> -     snprintf(cmd, sizeof(cmd), "objcopy --add-section .SUNW_ctf=%s %s",
> +     char *cmd;
> +     static const char *ctf_command = "objcopy --add-section ";
> +
> +     len = strlen(ctf_command) + strlen(ctf_name) + 1 +
> +             strlen(pathname) + 1 + strlen(self->filename) + 1;
> +     cmd = malloc(len);
> +     if (cmd == NULL)
> +       goto out_close;

Shouldn't this be out_unlink like above?

> +     snprintf(cmd, len, "%s%s=%s %s", ctf_command, ctf_name,
>                pathname, self->filename);
>       if (system(cmd) == 0)
>               err = 0;
> +     free(cmd);
>  out_unlink:
>       unlink(pathname);
> +     free(pathname);
>       return err;
>  #endif
>  out_update:



> +     functions_filename = malloc(len);
> +     if (functions_filename == NULL)
> +             goto out;

Probably print some error like below?

> +     snprintf(functions_filename, len, "%s/%s%s",
> +             src_dir, class__name(tag__class(class), cu), functions_ext);
>       fp_functions = fopen(functions_filename, "w");
>       if (fp_functions == NULL) {
>               fprintf(stderr, "ctracer: couldn't create %s\n",


> +     static const char *methods_name = "ctracer_methods.stp";
> +     len = strlen(src_dir) + 1 + strlen(methods_name) + 1;
> +     methods_filename = malloc(len);
> +     if (methods_filename == NULL)
> +             goto out;

Ditto.

> +     snprintf(methods_filename, len,
> +              "%s/%s", src_dir, methods_name);
>       fp_methods = fopen(methods_filename, "w");
>       if (fp_methods == NULL) {
>               fprintf(stderr, "ctracer: couldn't create %s\n",


> +     static const char *collector_name = "ctracer_collector.c";
> +     len = strlen(src_dir) + 1 + strlen(collector_name) + 1;
> +     collector_filename = malloc(len);
> +     if (collector_filename == NULL)
> +             goto out;

Ditto.

> +     snprintf(collector_filename, len,
> +              "%s/%s", src_dir, collector_name);
>       fp_collector = fopen(collector_filename, "w");
>       if (fp_collector == NULL) {
>               fprintf(stderr, "ctracer: couldn't create %s\n",


> +     static const char *classes_name = "ctracer_classes.h";
> +     len = strlen(src_dir) + 1 + strlen(classes_name) + 1;
> +     classes_filename = malloc(len);
> +     if (classes_filename == NULL)
> +             goto out;

Ditto.

> +     snprintf(classes_filename, len,
> +              "%s/%s", src_dir, classes_name);
>       fp_classes = fopen(classes_filename, "w");
>       if (fp_classes == NULL) {
>               fprintf(stderr, "ctracer: couldn't create %s\n",


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: https://lists.debian.org/20140411055227.GA5197@type

Reply via email to