On Sat, Dec 10, 2022 at 01:59:04PM +0100, Alessandro Ricci wrote:
> Start fvwm then switch to cwm, now execute the restart function.
> Then fvwm is spawned. Well done.
> That's because now argv[0] = fvwm.
> I don't think fvwm needs to change, cwm has to.

Hi,

I think it's a bug in fvwm. The patch below fixes it. (ie when
execvp(1) is called, the new argv[0] should be set to the new command,
not the one fvwm was stàrted with. Only lightly tested, other pairs of
eyes may be needed before this can be committed.

(Note: I've other unrelated stuff in my tree, so the line numbers are
a bit off, but the patch should apply nevertheless)

Index: app/fvwm/fvwm/fvwm.c
===================================================================
RCS file: /cvs/OpenBSD/xenocara/app/fvwm/fvwm/fvwm.c,v
retrieving revision 1.3
diff -u -p -u -r1.3 fvwm.c
--- app/fvwm/fvwm/fvwm.c        15 Apr 2017 17:18:01 -0000      1.3
+++ app/fvwm/fvwm/fvwm.c        10 Dec 2022 14:43:50 -0000
@@ -1486,9 +1482,10 @@ void Done(int restart, char *command)
       char *my_argv[10];
       int i,done,j;
 
-      i=0;
-      j=0;
+      i=1;
+      j=1;
       done = 0;
+      my_argv[0] = command;
       while((g_argv[j] != NULL)&&(i<8))
       {
         if(strcmp(g_argv[j],"-s")!=0)


-- 
Matthieu Herrb

Reply via email to