On Sun, Aug 03, 2014 at 05:56:45PM -0400, David Korn wrote:
> Thanks for reporting this.  Try this patch and let me know if it fixes it
> for you:
> 
> --- old/bltins/print.c Thu May 29 07:49:59 2014
> +++ new/bltins/print.c Sun Aug  3 14:51:07 2014
> @@ -193,7 +193,8 @@
>   /* print to history file */
>   if(!sh_histinit((void*)shp))
>   errormsg(SH_DICT,ERROR_system(1),e_history);
> - fd = sffileno(shp->gd->hist_ptr->histfp);
> + outfile = shp->gd->hist_ptr->histfp;
> + fd = sffileno(outfile);
>   sh_onstate(shp,SH_HISTORY);
>   sflag++;
>   break;
> @@ -288,6 +289,8 @@
>   errno = EBADF;
>   n = 0;
>   }
> + else if(sflag)
> + n = IOREAD|IOWRITE|IOSEEK;
>   else if(!(n=shp->fdstatus[fd]))
>   n = sh_iocheckfd(shp,fd,fd);
>   if(!(n&IOWRITE))
> @@ -297,7 +300,7 @@
>   return(1);
>   errormsg(SH_DICT,ERROR_system(1),msg);
>   }
> - if(!(outfile=shp->sftable[fd]))
> + if(!sflag && !(outfile=shp->sftable[fd]))
>   {
>   sh_onstate(shp,SH_NOTRACK);
>   n = SF_WRITE|((n&IOREAD)?SF_READ:0);

Indeed this one works flawless, thanks a lot!

-- 
  "Having a smoking section in a restaurant is like having
          a peeing section in a swimming pool." -- Edward Burr

Attachment: pgpRzzeJp16Lj.pgp
Description: PGP signature

_______________________________________________
ast-developers mailing list
ast-developers@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to