Browse Source

* fix a bug in Exec if calling a program without arguments

git-svn-id: trunk@29526 -
Tomas Hajny 10 years ago
parent
commit
dcffcd22e7
1 changed files with 4 additions and 1 deletions
  1. 4 1
      rtl/os2/dos.pas

+ 4 - 1
rtl/os2/dos.pas

@@ -213,6 +213,7 @@ var
   SR: SearchRec;
   MaxArgsSize: PtrUInt; (* Amount of memory reserved for arguments in bytes. *)
   MaxArgsSizeInc: word;
+  PathZ: array [0..255] of char;
 
 begin
 {  LastDosExitCode := Exec (Path, ExecRunFlags (ExecFlags), efDefault, ComLine);}
@@ -235,6 +236,8 @@ begin
    begin
     Args0 := nil;
     Args := nil;
+    StrPCopy (PathZ, Path);
+    RC := DosQueryAppType (@PathZ [0], ExecAppType);
    end
   else
    begin
@@ -266,9 +269,9 @@ begin
     Args^ [ArgSize] := 0;
     Inc (ArgSize);
     Args^ [ArgSize] := 0;
+    RC := DosQueryAppType (PChar (Args), ExecAppType);
    end;
 
-  RC := DosQueryAppType (PChar (Args), ExecAppType);
   if RC <> 0 then
    OSErrorWatch (RC)
   else