Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix many errors that occur on 32-bit systems under UBSan #804

Merged
merged 2 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cmd/INIT/mamake.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ static void report(int level, char *text, char *item, Rule_t *r)
fprintf(stderr, "%s", text);
if (r && r->time && state.debug <= -2)
#if __STDC_VERSION__ >= 199901L
fprintf(stderr, " %lld", (long long)r->time);
fprintf(stderr, " %llu", (unsigned long long)r->time);
#else
fprintf(stderr, " %lu", (unsigned long)r->time);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/builtin/pty.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ mkpty(int* master, int* minion)
static Proc_t*
runcmd(char** argv, int minion, int session)
{
long ops[4];
int64_t ops[4];

if (session)
{
Expand Down
4 changes: 0 additions & 4 deletions src/cmd/ksh93/bltins/alarm.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,9 @@ static void putval(Namval_t* np, const char* val, int flag, Namfun_t* fp)
if(val)
{
double now;
#ifdef timeofday
struct timeval tmp;
timeofday(&tmp);
now = tmp.tv_sec + 1.e-6*tmp.tv_usec;
#else
now = (double)time(NULL);
#endif /* timeofday */
nv_putv(np,val,flag,fp);
d = nv_getnum(np);
if(*val=='+')
Expand Down
24 changes: 12 additions & 12 deletions src/cmd/ksh93/bltins/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,13 +520,13 @@ int b_jobs(int n,char *argv[],Shbltin_t *context)
*/
static void print_times(struct timeval utime, struct timeval stime)
{
int ut_min = utime.tv_sec / 60;
int ut_sec = utime.tv_sec % 60;
int ut_ms = utime.tv_usec / 1000;
int st_min = stime.tv_sec / 60;
int st_sec = stime.tv_sec % 60;
int st_ms = stime.tv_usec / 1000;
sfprintf(sfstdout, sh_isoption(SH_POSIX) ? "%dm%d%c%03ds %dm%d%c%03ds\n" : "%dm%02d%c%03ds %dm%02d%c%03ds\n",
Sfulong_t ut_min = utime.tv_sec / 60;
Sfulong_t ut_sec = utime.tv_sec % 60;
Sfulong_t ut_ms = utime.tv_usec / 1000;
Sfulong_t st_min = stime.tv_sec / 60;
Sfulong_t st_sec = stime.tv_sec % 60;
Sfulong_t st_ms = stime.tv_usec / 1000;
sfprintf(sfstdout, sh_isoption(SH_POSIX) ? "%jum%ju%c%03jus %jum%ju%c%03jus\n" : "%jum%02ju%c%03jus %jum%02ju%c%03jus\n",
ut_min, ut_sec, sh.radixpoint, ut_ms, st_min, st_sec, sh.radixpoint, st_ms);
}
#if _lib_getrusage
Expand All @@ -545,23 +545,23 @@ static void print_cpu_times(void)
static void print_cpu_times(void)
{
struct timeval utime, stime;
double dtime;
Sfdouble_t dtime;
int clk_tck = sh.lim.clk_tck;
struct tms cpu_times;
times(&cpu_times);
/* Print the time (user & system) consumed by the shell. */
dtime = (double)cpu_times.tms_utime / clk_tck;
dtime = (Sfdouble_t)cpu_times.tms_utime / clk_tck;
utime.tv_sec = dtime / 60;
utime.tv_usec = 1000000 * (dtime - utime.tv_sec);
dtime = (double)cpu_times.tms_stime / clk_tck;
dtime = (Sfdouble_t)cpu_times.tms_stime / clk_tck;
stime.tv_sec = dtime / 60;
stime.tv_usec = 1000000 * (dtime - utime.tv_sec);
print_times(utime, stime);
/* Print the time (user & system) consumed by the child processes of the shell. */
dtime = (double)cpu_times.tms_cutime / clk_tck;
dtime = (Sfdouble_t)cpu_times.tms_cutime / clk_tck;
utime.tv_sec = dtime / 60;
utime.tv_usec = 1000000 * (dtime - utime.tv_sec);
dtime = (double)cpu_times.tms_cstime / clk_tck;
dtime = (Sfdouble_t)cpu_times.tms_cstime / clk_tck;
stime.tv_sec = dtime / 60;
stime.tv_usec = 1000000 * (dtime - utime.tv_sec);
print_times(utime, stime);
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/bltins/trap.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ int b_suspend(int argc,char *argv[],Shbltin_t *context)
}
if(kill(sh.pid, SIGSTOP) != 0)
{
errormsg(SH_DICT, ERROR_exit(1), "could not signal main shell at PID %d", sh.pid);
errormsg(SH_DICT, ERROR_exit(1), "could not signal main shell at PID %jd", (Sflong_t)sh.pid);
UNREACHABLE();
}
return 0;
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/ksh93/edit/history.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ int sh_histinit(void)
if(hist_clean(fd) && hist_start>1 && hsize > HIST_MAX)
{
#ifdef DEBUG
sfprintf(sfstderr,"%lld: hist_trim hsize=%d\n",(Sflong_t)sh.current_pid,hsize);
sfprintf(sfstderr,"%jd: hist_trim hsize=%d\n",(Sflong_t)sh.current_pid,hsize);
sfsync(sfstderr);
#endif /* DEBUG */
hp = hist_trim(hp,(int)hp->histind-maxlines);
Expand Down Expand Up @@ -747,9 +747,9 @@ static ssize_t hist_write(Sfio_t *iop,const void *buff,size_t insize,Sfdisc_t* h
if(hp->auditfp)
{
time_t t=time(NULL);
sfprintf(hp->auditfp, "%u;%lu;%s;%*s%c",
sfprintf(hp->auditfp, "%u;%ju;%s;%*s%c",
sh_isoption(SH_PRIVILEGED) ? sh.euserid : sh.userid,
(unsigned long)t, hp->tty, size, buff, 0);
(Sfulong_t)t, hp->tty, size, buff, 0);
sfsync(hp->auditfp);
}
#endif /* SHOPT_AUDIT */
Expand Down
14 changes: 7 additions & 7 deletions src/cmd/ksh93/include/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,17 @@ extern char *sh_getcwd(void);
#endif
#define sh_translate(s) _sh_translate(ERROR_dictionary(s))

#define WBITS (sizeof(long)*8)
#define WBITS (sizeof(uint64_t)*8)
#define WMASK (0xff)

#if SHOPT_SCRIPTONLY
#define is_option(s,x) ((x)==SH_INTERACTIVE || (x)==SH_HISTORY ? 0 : ((s)->v[((x)&WMASK)/WBITS] & (1L << ((x) % WBITS))) )
#define on_option(s,x) ( (x)==SH_INTERACTIVE || (x)==SH_HISTORY ? errormsg(SH_DICT,ERROR_exit(1),e_scriptonly) : ((s)->v[((x)&WMASK)/WBITS] |= (1L << ((x) % WBITS))) )
#define off_option(s,x) ((x)==SH_INTERACTIVE || (x)==SH_HISTORY ? 0 : ((s)->v[((x)&WMASK)/WBITS] &= ~(1L << ((x) % WBITS))) )
#define is_option(s,x) ((x)==SH_INTERACTIVE || (x)==SH_HISTORY ? 0 : ((s)->v[((x)&WMASK)/WBITS] & ((uint64_t)1 << ((x) % WBITS))) )
#define on_option(s,x) ( (x)==SH_INTERACTIVE || (x)==SH_HISTORY ? errormsg(SH_DICT,ERROR_exit(1),e_scriptonly) : ((s)->v[((x)&WMASK)/WBITS] |= ((uint64_t)1 << ((x) % WBITS))) )
#define off_option(s,x) ((x)==SH_INTERACTIVE || (x)==SH_HISTORY ? 0 : ((s)->v[((x)&WMASK)/WBITS] &= ~((uint64_t)1 << ((x) % WBITS))) )
#else
#define is_option(s,x) ((s)->v[((x)&WMASK)/WBITS] & (1L << ((x) % WBITS)))
#define on_option(s,x) ((s)->v[((x)&WMASK)/WBITS] |= (1L << ((x) % WBITS)))
#define off_option(s,x) ((s)->v[((x)&WMASK)/WBITS] &= ~(1L << ((x) % WBITS)))
#define is_option(s,x) ((s)->v[((x)&WMASK)/WBITS] & ((uint64_t)1 << ((x) % WBITS)))
#define on_option(s,x) ((s)->v[((x)&WMASK)/WBITS] |= ((uint64_t)1 << ((x) % WBITS)))
#define off_option(s,x) ((s)->v[((x)&WMASK)/WBITS] &= ~((uint64_t)1 << ((x) % WBITS)))
#endif /* SHOPT_SCRIPTONLY */
#define sh_isoption(x) is_option(&sh.options,x)
#define sh_onoption(x) on_option(&sh.options,x)
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/include/fault.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ extern void sh_sigdone(void);
extern void sh_siginit(void);
extern void sh_sigtrap(int);
extern void sh_sigreset(int);
extern void *sh_timeradd(unsigned long,int ,void (*)(void*),void*);
extern void *sh_timeradd(Sfulong_t,int ,void (*)(void*),void*);
extern void sh_timerdel(void*);

extern const char e_alarm[];
Expand Down
8 changes: 4 additions & 4 deletions src/cmd/ksh93/include/shell.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
/* options */
typedef struct
{
unsigned long v[4];
uint64_t v[4];
}
Shopt_t;

Expand Down Expand Up @@ -476,9 +476,9 @@ extern void *sh_waitnotify(Shwait_f);
extern Shscope_t *sh_getscope(int,int);
extern Shscope_t *sh_setscope(Shscope_t*);
extern void sh_sigcheck(void);
extern unsigned long sh_isoption(int);
extern unsigned long sh_onoption(int);
extern unsigned long sh_offoption(int);
extern uint64_t sh_isoption(int);
extern uint64_t sh_onoption(int);
extern uint64_t sh_offoption(int);
extern int sh_exec(const Shnode_t*,int);

/*
Expand Down
17 changes: 6 additions & 11 deletions src/cmd/ksh93/sh/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ static int rand_shift;
*/
static noreturn void *nomemory(size_t s)
{
errormsg(SH_DICT, ERROR_SYSTEM|ERROR_PANIC, "out of memory (needed %llu bytes)", (uintmax_t)s);
errormsg(SH_DICT, ERROR_SYSTEM|ERROR_PANIC, "out of memory (needed %zu bytes)", s);
UNREACHABLE();
}

Expand Down Expand Up @@ -552,13 +552,8 @@ static char* get_ifs(Namval_t* np, Namfun_t *fp)
/*
* these functions are used to get and set the SECONDS variable
*/
#ifdef timeofday
# define dtime(tp) ((double)((tp)->tv_sec)+1e-6*((double)((tp)->tv_usec)))
# define tms timeval
#else
# define dtime(tp) (((double)times(tp))/sh.lim.clk_tck)
# define timeofday(a)
#endif
#define dtime(tp) ((double)((tp)->tv_sec)+1e-6*((double)((tp)->tv_usec)))
#define tms timeval

static void put_seconds(Namval_t* np,const char *val,int flags,Namfun_t *fp)
{
Expand Down Expand Up @@ -1921,17 +1916,17 @@ static void env_init(void)
*/
#define BYPASS_MACRO

unsigned long sh_isoption BYPASS_MACRO (int opt)
uint64_t sh_isoption BYPASS_MACRO (int opt)
{
return sh_isoption(opt);
}

unsigned long sh_onoption BYPASS_MACRO (int opt)
uint64_t sh_onoption BYPASS_MACRO (int opt)
{
return sh_onoption(opt);
}

unsigned long sh_offoption BYPASS_MACRO (int opt)
uint64_t sh_offoption BYPASS_MACRO (int opt)
{
return sh_offoption(opt);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/sh/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ static char *io_usename(char *name, int *perm, int fno, int mode)
ep = sp;
stkseek(sh.stk,0);
}
sfprintf(sh.stk, ".<#%lld_%d{;.tmp", (Sflong_t)sh.current_pid, fno);
sfprintf(sh.stk, ".<#%jd_%d{;.tmp", (Sflong_t)sh.current_pid, fno);
tname = stkfreeze(sh.stk,1);
switch(mode)
{
Expand Down
28 changes: 14 additions & 14 deletions src/cmd/ksh93/sh/jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ int job_reap(int sig)
Waitevent_f waitevent = sh.waitevent;
static int wcontinued = WCONTINUED;
#ifdef DEBUG
if(sfprintf(sfstderr,"ksh: job line %4d: reap PID=%lld critical=%d signal=%d\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,sig) <=0)
if(sfprintf(sfstderr,"ksh: job line %4d: reap PID=%jd critical=%d signal=%d\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,sig) <=0)
write(2,"waitsafe\n",9);
sfsync(sfstderr);
#endif /* DEBUG */
Expand Down Expand Up @@ -314,7 +314,7 @@ int job_reap(int sig)
if(!(pw=job_bypid(pid)))
{
#ifdef DEBUG
sfprintf(sfstderr,"ksh: job line %4d: reap PID=%lld critical=%d unknown job PID=%d pw=%x\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,pid,pw);
sfprintf(sfstderr,"ksh: job line %4d: reap PID=%jd critical=%d unknown job PID=%jd pw=%x\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,(Sflong_t)pid,pw);
#endif /* DEBUG */
if (WIFCONTINUED(wstat) && wcontinued)
continue;
Expand Down Expand Up @@ -420,7 +420,7 @@ int job_reap(int sig)
jp->exitval |= SH_EXITSIG;
}
#ifdef DEBUG
sfprintf(sfstderr,"ksh: job line %4d: reap PID=%lld critical=%d job %d with PID %d flags=%o complete with status=%x exit=%d\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,pw->p_job,pid,pw->p_flag,wstat,pw->p_exit);
sfprintf(sfstderr,"ksh: job line %4d: reap PID=%jd critical=%d job %d with PID %jd flags=%o complete with status=%x exit=%d\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,pw->p_job,(Sflong_t)pid,pw->p_flag,wstat,pw->p_exit);
sfsync(sfstderr);
#endif /* DEBUG */
/* only top-level process in job should have notify set */
Expand Down Expand Up @@ -787,7 +787,7 @@ int job_list(struct process *pw,int flag)
return 0;
if((flag&JOB_PFLAG))
{
sfprintf(outfile,"%d\n",px->p_pgrp?px->p_pgrp:px->p_pid);
sfprintf(outfile,"%jd\n",(Sflong_t)(px->p_pgrp?px->p_pgrp:px->p_pid));
return 0;
}
if((px->p_flag&P_DONE) && job.waitall && !(flag&JOB_LFLAG))
Expand All @@ -807,7 +807,7 @@ int job_list(struct process *pw,int flag)
{
n = 0;
if(flag&JOB_LFLAG)
sfprintf(outfile,"%d\t",px->p_pid);
sfprintf(outfile,"%jd\t",(Sflong_t)px->p_pid);
if(px->p_flag&P_SIGNALLED)
msg = job_sigmsg((int)(px->p_exit));
else if(px->p_flag&P_NOTIFY)
Expand All @@ -822,7 +822,7 @@ int job_list(struct process *pw,int flag)
msize = strlen(msg);
if(n)
{
sfprintf(outfile,"(%d)",(int)n);
sfprintf(outfile,"(%d)",n);
msize += (3+(n>10)+(n>100));
}
if(px->p_flag&P_COREDUMP)
Expand Down Expand Up @@ -1158,8 +1158,8 @@ int job_post(pid_t pid, pid_t join)
pw->p_fgrp = 0;
pw->p_pgrp = pw->p_fgrp;
#ifdef DEBUG
sfprintf(sfstderr,"ksh: job line %4d: post PID=%lld critical=%d job=%d PID=%d PGID=%d savesig=%d join=%d\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,pw->p_job,
pw->p_pid,pw->p_pgrp,job.savesig,join);
sfprintf(sfstderr,"ksh: job line %4d: post PID=%jd critical=%d job=%d PID=%jd PGID=%jd savesig=%d join=%d\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,pw->p_job,
(Sflong_t)pw->p_pid,(Sflong_t)pw->p_pgrp,job.savesig,join);
sfsync(sfstderr);
#endif /* DEBUG */
if(hp && !sh_isstate(SH_PROFILE) && !sh.realsubshell)
Expand Down Expand Up @@ -1242,7 +1242,7 @@ static void job_prmsg(struct process *pw)
if(sh_isstate(SH_INTERACTIVE))
sfprintf(sfstderr,"%s%s\n",msg,dump);
else
errormsg(SH_DICT,2,"%d: %s%s",pw->p_pid,msg,dump);
errormsg(SH_DICT,2,"%jd: %s%s",(Sflong_t)pw->p_pid,msg,dump);
}
}

Expand Down Expand Up @@ -1304,9 +1304,9 @@ int job_wait(pid_t pid)
}
pwfg = pw;
#ifdef DEBUG
sfprintf(sfstderr,"ksh: job line %4d: wait PID=%lld critical=%d job=%d PID=%d\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,jobid,pid);
sfprintf(sfstderr,"ksh: job line %4d: wait PID=%jd critical=%d job=%d PID=%jd\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,jobid,(Sflong_t)pid);
if(pw)
sfprintf(sfstderr,"ksh: job line %4d: wait PID=%lld critical=%d flags=%o\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,pw->p_flag);
sfprintf(sfstderr,"ksh: job line %4d: wait PID=%jd critical=%d flags=%o\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,pw->p_flag);
#endif /* DEBUG */
errno = 0;
if(sh.coutpipe>=0 && lastpid && sh.cpid==lastpid)
Expand Down Expand Up @@ -1547,7 +1547,7 @@ static struct process *job_unpost(struct process *pwtop,int notify)
struct process *pw;
/* make sure all processes are done */
#ifdef DEBUG
sfprintf(sfstderr,"ksh: job line %4d: drop PID=%lld critical=%d PID=%d env=%u\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,pwtop->p_pid,pwtop->p_env);
sfprintf(sfstderr,"ksh: job line %4d: drop PID=%jd critical=%d PID=%jd env=%u\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,(Sflong_t)pwtop->p_pid,pwtop->p_env);
sfsync(sfstderr);
#endif /* DEBUG */
pwtop = pw = job_byjid(pwtop->p_job);
Expand Down Expand Up @@ -1593,7 +1593,7 @@ static struct process *job_unpost(struct process *pwtop,int notify)
}
pwtop->p_pid = 0;
#ifdef DEBUG
sfprintf(sfstderr,"ksh: job line %4d: free PID=%lld critical=%d job=%d\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,pwtop->p_job);
sfprintf(sfstderr,"ksh: job line %4d: free PID=%jd critical=%d job=%d\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,pwtop->p_job);
sfsync(sfstderr);
#endif /* DEBUG */
job_free(pwtop->p_job);
Expand Down Expand Up @@ -1783,7 +1783,7 @@ void job_subrestore(void* ptr)
void job_fork(pid_t parent)
{
#ifdef DEBUG
sfprintf(sfstderr,"ksh: job line %4d: fork PID=%lld critical=%d parent=%d\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,parent);
sfprintf(sfstderr,"ksh: job line %4d: fork PID=%jd critical=%d parent=%d\n",__LINE__,(Sflong_t)sh.current_pid,job.in_critical,parent);
#endif /* DEBUG */
switch (parent)
{
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/sh/lex.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ int sh_lex(Lex_t *lp)
if(flag&ARG_QUOTED)
quoted = "quoted:";
}
sfprintf(sfstderr,"%lld: line %d: %o:%s%s%s%s %s\n",(Sflong_t)sh.current_pid,sh.inlineno,tok,quoted,
sfprintf(sfstderr,"%jd: line %d: %o:%s%s%s%s %s\n",(Sflong_t)sh.current_pid,sh.inlineno,tok,quoted,
macro, split, expand, fmttoken(lp,tok));
return tok;
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/sh/macro.c
Original file line number Diff line number Diff line change
Expand Up @@ -2190,7 +2190,7 @@ static void comsubst(Mac_t *mp,Shnode_t* t, int type)
if((Sflong_t)num!=num)
sfprintf(sh.strbuf,"%.*Lg",LDBL_DIG,num);
else if(num)
sfprintf(sh.strbuf,"%lld",(Sflong_t)num);
sfprintf(sh.strbuf,"%jd",(Sflong_t)num);
else
sfprintf(sh.strbuf,"%Lg",num);
str = sfstruse(sh.strbuf);
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/sh/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ static void exfile(Sfio_t *iop,int fno)
{
buff.mode = SH_JMPERREXIT;
#ifdef DEBUG
errormsg(SH_DICT,ERROR_warn(0),"%lld: mode changed to SH_JMPERREXIT",(Sflong_t)sh.current_pid);
errormsg(SH_DICT,ERROR_warn(0),"%jd: mode changed to SH_JMPERREXIT",(Sflong_t)sh.current_pid);
#endif
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/ksh93/sh/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -2082,12 +2082,12 @@ int kiaclose(Lex_t *lexp)
sfmove(kia.tmp,kia.file,SFIO_UNBOUND,-1);
off2 = sfseek(kia.file,0,SEEK_END);
if(off2==off1)
n= sfprintf(kia.file,"DIRECTORY\nENTITY;%lld;%d\nDIRECTORY;",(Sflong_t)kia.begin,(size_t)(off1-kia.begin));
n= sfprintf(kia.file,"DIRECTORY\nENTITY;%jd;%zu\nDIRECTORY;",(Sflong_t)kia.begin,(size_t)(off1-kia.begin));
else
n= sfprintf(kia.file,"DIRECTORY\nENTITY;%lld;%d\nRELATIONSHIP;%lld;%d\nDIRECTORY;",(Sflong_t)kia.begin,(size_t)(off1-kia.begin),(Sflong_t)off1,(size_t)(off2-off1));
n= sfprintf(kia.file,"DIRECTORY\nENTITY;%jd;%zu\nRELATIONSHIP;%jd;%zu\nDIRECTORY;",(Sflong_t)kia.begin,(size_t)(off1-kia.begin),(Sflong_t)off1,(size_t)(off2-off1));
if(off2 >= INT_MAX)
off2 = -(n+12);
sfprintf(kia.file,"%010.10lld;%010d\n",(Sflong_t)off2+10, n+12);
sfprintf(kia.file,"%010.10jd;%010d\n",(Sflong_t)off2+10, n+12);
}
return sfclose(kia.file);
}
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/ksh93/sh/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ pid_t path_spawn(const char *opath,char **argv, char **envp, Pathcomp_t *libpath
#if _lib_readlink
/* save original pathname */
stkseek(sh.stk,PATH_OFFSET);
pidsize = sfprintf(sh.stk, "*%lld*", (Sflong_t)(spawn ? sh.current_pid : sh.current_ppid));
pidsize = sfprintf(sh.stk, "*%jd*", (Sflong_t)(spawn ? sh.current_pid : sh.current_ppid));
sfputr(sh.stk,opath,-1);
opath = stkfreeze(sh.stk,1)+PATH_OFFSET+pidsize;
np = path_gettrackedalias(argv[0]);
Expand Down
Loading