@@ -714,15 +714,13 @@ int main(int argc, char **argv_orig, char **envp) {
714
714
case 'Q' :
715
715
716
716
if (fsrv -> qemu_mode ) { FATAL ("Multiple -Q options not supported" ); }
717
- if (!mem_limit_given ) { fsrv -> mem_limit = MEM_LIMIT_QEMU ; }
718
717
719
718
fsrv -> qemu_mode = 1 ;
720
719
break ;
721
720
722
721
case 'U' :
723
722
724
723
if (unicorn_mode ) { FATAL ("Multiple -U options not supported" ); }
725
- if (!mem_limit_given ) { fsrv -> mem_limit = MEM_LIMIT_UNICORN ; }
726
724
727
725
unicorn_mode = 1 ;
728
726
break ;
@@ -733,8 +731,6 @@ int main(int argc, char **argv_orig, char **envp) {
733
731
fsrv -> qemu_mode = 1 ;
734
732
use_wine = 1 ;
735
733
736
- if (!mem_limit_given ) { fsrv -> mem_limit = 0 ; }
737
-
738
734
break ;
739
735
740
736
case 'b' :
@@ -772,6 +768,9 @@ int main(int argc, char **argv_orig, char **envp) {
772
768
773
769
if (optind == argc || !out_file ) { usage (argv [0 ]); }
774
770
771
+ if (fsrv -> qemu_mode && !mem_limit_given ) { fsrv -> mem_limit = MEM_LIMIT_QEMU ; }
772
+ if (unicorn_mode && !mem_limit_given ) { fsrv -> mem_limit = MEM_LIMIT_UNICORN ; }
773
+
775
774
check_environment_vars (envp );
776
775
777
776
sharedmem_t shm = {0 };
@@ -800,12 +799,6 @@ int main(int argc, char **argv_orig, char **envp) {
800
799
801
800
}
802
801
803
- for (i = optind ; i < argc ; i ++ ) {
804
-
805
- if (strcmp (argv [i ], "@@" ) == 0 ) { arg_offset = i ; }
806
-
807
- }
808
-
809
802
if (fsrv -> qemu_mode ) {
810
803
811
804
if (use_wine ) {
@@ -826,6 +819,14 @@ int main(int argc, char **argv_orig, char **envp) {
826
819
827
820
}
828
821
822
+ i = 0 ;
823
+ while (use_argv [i ] != NULL && !arg_offset ) {
824
+
825
+ if (strcmp (use_argv [i ], "@@" ) == 0 ) { arg_offset = i ; }
826
+ i ++ ;
827
+
828
+ }
829
+
829
830
if (in_dir ) {
830
831
831
832
DIR * dir_in , * dir_out ;
@@ -870,10 +871,9 @@ int main(int argc, char **argv_orig, char **envp) {
870
871
fsrv -> out_fd = open (stdin_file , O_RDWR | O_CREAT | O_EXCL , 0600 );
871
872
if (fsrv -> out_fd < 0 ) { PFATAL ("Unable to create '%s'" , out_file ); }
872
873
873
- if (arg_offset && argv [arg_offset ] != stdin_file ) {
874
+ if (arg_offset && use_argv [arg_offset ] != stdin_file ) {
874
875
875
- ck_free (argv [arg_offset ]);
876
- argv [arg_offset ] = strdup (stdin_file );
876
+ use_argv [arg_offset ] = strdup (stdin_file );
877
877
878
878
}
879
879
@@ -888,8 +888,6 @@ int main(int argc, char **argv_orig, char **envp) {
888
888
}
889
889
890
890
SAYF ("\n" );
891
- SAYF (cMGN "[D]" cRST " %d - %d = %d, %s\n" , arg_offset , optind ,
892
- arg_offset - optind , infile );
893
891
894
892
}
895
893
0 commit comments