]> cvs.zerfleddert.de Git - rsbs2/blobdiff - filesystem.c
add correct handle to sensorpropget requests
[rsbs2] / filesystem.c
index d4b207e7b8b5cca78e86a9c82f6b72dc83ec48e0..d6446796e7e33918ed1ca531ffe09dcbb6e2a1a5 100644 (file)
@@ -93,6 +93,8 @@ void extract_files(unsigned char *fw, int len)
                        write_file(extracted_file(fent->name), fent->start, fent->length);
                        if (*((unsigned int*)fent->start) == LZ_MAGIC) {
                                char *lzname;
+                               unsigned char *outbuf;
+                               unsigned int outlen;
 
                                if ((lzname = strdup(fent->name)) == NULL) {
                                        perror("strdup");
@@ -107,7 +109,10 @@ void extract_files(unsigned char *fw, int len)
 
                                printf("%s: packed file found, ", lzname);
 
-                               extract_lz_file(fent->start, (unsigned char*)lzname, 0);
+                               outbuf = extract_lz_file(fent->start, &outlen, 0);
+                               write_file(extracted_file((char*)lzname), outbuf, outlen);
+
+                               free(outbuf);
                                free(lzname);
                        } else if (!strcmp(fent->name, "firmware")) {
                                unsigned char *lzpos;
@@ -120,8 +125,15 @@ void extract_files(unsigned char *fw, int len)
                                memcpy(lzname + strlen(lzname), lzpos - 4, 4);
                                lzpos += 4;
                                if (*((unsigned int*)(lzpos)) == LZ_MAGIC) {
-                                       printf("%s: compressed firmware part found, ", lzname);
-                                       extract_lz_file(lzpos, (unsigned char*)lzname, 1);
+                                       unsigned char *outbuf;
+                                       unsigned int outlen;
+
+                                       printf("%s: compressed firmware part found", lzname);
+                                       outbuf = extract_lz_file(lzpos, &outlen, 1);
+                                       printf(", ");
+                                       write_file(extracted_file((char*)lzname), outbuf, outlen);
+
+                                       free(outbuf);
                                }
                        }
                } else {
Impressum, Datenschutz