@@ -29,7 +29,7 @@ static debug_t _debugger;
29
29
})
30
30
31
31
struct repository_file_t {
32
- const char * url ;
32
+ char * url ;
33
33
const char * dir ;
34
34
const char * file ;
35
35
const char * secret ;
@@ -87,7 +87,7 @@ http_get_response_t *repository_fetch_package_manifest(const char *package_url,
87
87
char * manifest_url = repository_create_url_for_file (package_url , package_id , version , manifest_file , secret );
88
88
89
89
http_get_response_t * res ;
90
- if (strstr (package_url , "gitlab" ) != NULL ) {
90
+ if (secret && strstr (package_url , "gitlab" ) != NULL ) {
91
91
char * key = "PRIVATE-TOKEN" ;
92
92
unsigned int size = strlen (key ) + strlen (secret ) + 2 ;
93
93
char * authentication_header = malloc (size );
@@ -98,6 +98,8 @@ http_get_response_t *repository_fetch_package_manifest(const char *package_url,
98
98
res = http_get_shared (manifest_url , clib_package_curl_share , NULL , 0 );
99
99
}
100
100
101
+ free (manifest_url );
102
+
101
103
return res ;
102
104
}
103
105
@@ -116,7 +118,11 @@ repository_file_handle_t repository_download_package_file(const char *package_ur
116
118
117
119
void repository_file_finish_download (repository_file_handle_t file ) {
118
120
void * rc ;
119
- pthread_join (file -> thread , & rc );
121
+ int success = pthread_join (file -> thread , & rc );
122
+ if (success != 0 ) {
123
+ printf ("Failed to join thread.\n" );
124
+ }
125
+ free (rc );
120
126
}
121
127
122
128
void repository_file_free (repository_file_handle_t file ) {
@@ -133,8 +139,6 @@ static int fetch_package_file_work(const char *url, const char *dir, const char
133
139
return 1 ;
134
140
}
135
141
136
- _debug ("file URL: %s" , url );
137
-
138
142
if (!(path = path_join (dir , basename (file )))) {
139
143
rc = 1 ;
140
144
goto cleanup ;
@@ -145,14 +149,14 @@ static int fetch_package_file_work(const char *url, const char *dir, const char
145
149
#endif
146
150
147
151
if (package_opts .force || -1 == fs_exists (path )) {
148
- _debug ("repository" , " fetching %s" , url );
152
+ _debug ("fetching %s" , url );
149
153
fflush (stdout );
150
154
151
155
#ifdef HAVE_PTHREADS
152
156
pthread_mutex_unlock (& mutex );
153
157
#endif
154
158
155
- if (strstr (url , "gitlab" ) != NULL ) {
159
+ if (secret && strstr (url , "gitlab" ) != NULL ) {
156
160
char * key = "PRIVATE-TOKEN" ;
157
161
unsigned int size = strlen (key ) + strlen (secret ) + 2 ;
158
162
char * authentication_header = malloc (size );
@@ -186,7 +190,7 @@ static int fetch_package_file_work(const char *url, const char *dir, const char
186
190
#ifdef HAVE_PTHREADS
187
191
pthread_mutex_lock (& mutex );
188
192
#endif
189
- _debug ("repository" , " saved %s" , path );
193
+ _debug ("saved %s" , path );
190
194
fflush (stdout );
191
195
#ifdef HAVE_PTHREADS
192
196
pthread_mutex_unlock (& mutex );
0 commit comments