@@ -508,17 +508,27 @@ http_copy_file(const char *path, // I - Directory
508508 struct stat fileinfo ; // File information
509509
510510
511+ DEBUG_printf ("3http_copy_file(path=\"%s\", common_name=\"%s\", ext=\"%s\")" , path , common_name , ext );
512+
511513 if (!common_name )
512514 return (NULL );
513515
514516 if (!path )
515517 path = http_default_path (defpath , sizeof (defpath ));
516518
517519 if ((fd = open (http_make_path (filename , sizeof (filename ), path , common_name , ext ), O_RDONLY )) < 0 )
520+ {
521+ DEBUG_printf ("4http_copy_file: open() failed: %s" , strerror (errno ));
518522 return (NULL );
523+ }
519524
520525 if (fstat (fd , & fileinfo ))
526+ {
527+ DEBUG_printf ("4http_copy_file: fstat() failed: %s" , strerror (errno ));
521528 goto done ;
529+ }
530+
531+ DEBUG_printf ("4http_copy_file: st_size=%lu" , (unsigned long )fileinfo .st_size );
522532
523533 if (fileinfo .st_size > 65536 )
524534 {
@@ -528,12 +538,14 @@ http_copy_file(const char *path, // I - Directory
528538
529539 if ((s = calloc (1 , (size_t )fileinfo .st_size + 1 )) == NULL )
530540 {
541+ DEBUG_printf ("4http_copy_file: calloc() failed: %s" , strerror (errno ));
531542 close (fd );
532543 return (NULL );
533544 }
534545
535546 if (read (fd , s , (size_t )fileinfo .st_size ) < 0 )
536547 {
548+ DEBUG_printf ("4http_copy_file: read() failed: %s" , strerror (errno ));
537549 free (s );
538550 s = NULL ;
539551 }
@@ -542,6 +554,8 @@ http_copy_file(const char *path, // I - Directory
542554
543555 close (fd );
544556
557+ DEBUG_printf ("4http_copy_file: Returning \"%s\"" , s );
558+
545559 return (s );
546560}
547561
@@ -565,7 +579,7 @@ http_default_path(
565579
566580 if (!_cupsDirCreate (buffer , 0700 ))
567581 {
568- DEBUG_printf ("1http_default_path : Failed to make directory '%s': %s" , buffer , strerror (errno ));
582+ DEBUG_printf ("4http_default_path : Failed to make directory '%s': %s" , buffer , strerror (errno ));
569583 return (NULL );
570584 }
571585 }
@@ -575,12 +589,12 @@ http_default_path(
575589
576590 if (!_cupsDirCreate (buffer , 0700 ))
577591 {
578- DEBUG_printf ("1http_default_path : Failed to make directory '%s': %s" , buffer , strerror (errno ));
592+ DEBUG_printf ("4http_default_path : Failed to make directory '%s': %s" , buffer , strerror (errno ));
579593 return (NULL );
580594 }
581595 }
582596
583- DEBUG_printf ("1http_default_path : Using default path \"%s\"." , buffer );
597+ DEBUG_printf ("4http_default_path : Using default path \"%s\"." , buffer );
584598
585599 return (buffer );
586600}
@@ -701,6 +715,8 @@ http_make_path(
701715 * bufend = buffer + bufsize - 1 ; // End of buffer
702716
703717
718+ DEBUG_printf ("3http_make_path(buffer=%p, bufsize=%u, dirname=\"%s\", filename=\"%s\", ext=\"%s\")" , (void * )buffer , (unsigned )bufsize , dirname , filename , ext );
719+
704720 snprintf (buffer , bufsize , "%s/" , dirname );
705721 bufptr = buffer + strlen (buffer );
706722
@@ -719,6 +735,8 @@ http_make_path(
719735
720736 cupsCopyString (bufptr , ext , (size_t )(bufend - bufptr + 1 ));
721737
738+ DEBUG_printf ("4http_make_path: Returning \"%s\"." , buffer );
739+
722740 return (buffer );
723741}
724742
0 commit comments