1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-11 13:01:28 +02:00

27021: fix length of saved glob flags in pattern matching

This commit is contained in:
Peter Stephenson 2009-05-29 21:06:40 +00:00
parent 4e5ac964e6
commit 71865fd36d
2 changed files with 13 additions and 6 deletions

View file

@ -1,3 +1,9 @@
2009-05-29 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 27021: Src/pattern.c: length of variable saving globflags
was wrong causing restored value to be wrong in pattern matching
on big-endian 64-bit systems.
2009-05-28 Peter Stephenson <pws@csr.com> 2009-05-28 Peter Stephenson <pws@csr.com>
* Jun T.: 27010: Completion/Unix/Command/_date: Darwin. * Jun T.: 27010: Completion/Unix/Command/_date: Darwin.
@ -11780,5 +11786,5 @@
***************************************************** *****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL * This is used by the shell to define $ZSH_PATCHLEVEL
* $Revision: 1.4701 $ * $Revision: 1.4702 $
***************************************************** *****************************************************

View file

@ -668,7 +668,8 @@ patcompswitch(int paren, int *flagp)
{ {
long starter, br, ender, excsync = 0; long starter, br, ender, excsync = 0;
int parno = 0; int parno = 0;
int flags, gfchanged = 0, savglobflags = patglobflags; int flags, gfchanged = 0;
long savglobflags = (long)patglobflags;
Upat ptr; Upat ptr;
*flagp = 0; *flagp = 0;
@ -688,7 +689,7 @@ patcompswitch(int paren, int *flagp)
br = patnode(P_BRANCH); br = patnode(P_BRANCH);
if (!patcompbranch(&flags)) if (!patcompbranch(&flags))
return 0; return 0;
if (patglobflags != savglobflags) if (patglobflags != (int)savglobflags)
gfchanged++; gfchanged++;
if (starter) if (starter)
pattail(starter, br); pattail(starter, br);
@ -777,7 +778,7 @@ patcompswitch(int paren, int *flagp)
patadd((char *)&up, 0, sizeof(union upat), 0); patadd((char *)&up, 0, sizeof(union upat), 0);
} }
} else { } else {
patglobflags = savglobflags; patglobflags = (int)savglobflags;
} }
} }
newbr = patcompbranch(&flags); newbr = patcompbranch(&flags);
@ -792,7 +793,7 @@ patcompswitch(int paren, int *flagp)
return 0; return 0;
if (gfnode) if (gfnode)
pattail(gfnode, newbr); pattail(gfnode, newbr);
if (!tilde && patglobflags != savglobflags) if (!tilde && patglobflags != (int)savglobflags)
gfchanged++; gfchanged++;
pattail(starter, br); pattail(starter, br);
if (excsync) if (excsync)
@ -831,7 +832,7 @@ patcompswitch(int paren, int *flagp)
* a later branch happened to put the flags back. * a later branch happened to put the flags back.
*/ */
pattail(ender, patnode(P_GFLAGS)); pattail(ender, patnode(P_GFLAGS));
patglobflags = savglobflags; patglobflags = (int)savglobflags;
patadd((char *)&savglobflags, 0, sizeof(long), 0); patadd((char *)&savglobflags, 0, sizeof(long), 0);
} }