fiasco: after fiasco_unpack return back to origin directory
This commit is contained in:
1 parent
3fed685e79
commit
df9fae0c0e
1 file changed
+24
-3
+24
-3
@@ -473,11 +473,23 @@ int fiasco_unpack(struct fiasco * fiasco, const char * dir) {
|
|||||||
struct image * image;
|
struct image * image;
|
||||||
struct image_list * image_list;
|
struct image_list * image_list;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
|
char cwd[256];
|
||||||
unsigned char buf[4096];
|
unsigned char buf[4096];
|
||||||
|
|
||||||
if ( dir && chdir(dir) < 0 ) {
|
if ( dir ) {
|
||||||
perror("Cannot chdir");
|
|
||||||
return -1;
|
memset(cwd, 0, sizeof(cwd));
|
||||||
|
|
||||||
|
if ( ! getcwd(cwd, sizeof(cwd)) ) {
|
||||||
|
perror("Cannot getcwd");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( chdir(dir) < 0 ) {
|
||||||
|
perror("Cannot chdir");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
image_list = fiasco->first;
|
image_list = fiasco->first;
|
||||||
@@ -556,6 +568,15 @@ int fiasco_unpack(struct fiasco * fiasco, const char * dir) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( dir ) {
|
||||||
|
|
||||||
|
if ( chdir(cwd) < 0 ) {
|
||||||
|
perror("Cannot chdir");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user