Commit 05cc83bf authored by Russ Cox's avatar Russ Cox

various: appease the ubuntu gcc monster

Silence warnings about not checking
return values from read and write system calls.

R=r, r2
CC=golang-dev
https://golang.org/cl/2258045
parent ec13ed1f
......@@ -482,7 +482,7 @@ asmb(void)
if(dlm){
char buf[8];
write(cout, buf, INITDAT-textsize);
ewrite(cout, buf, INITDAT-textsize);
textsize = INITDAT;
}
for(t = 0; t < datsize; t += sizeof(buf)-100) {
......@@ -987,7 +987,7 @@ cflush(void)
/* no bug if cbc < 0 since obuf(cbuf) followed by ibuf in buf! */
n = sizeof(buf.cbuf) - cbc;
if(n)
write(cout, buf.cbuf, n);
ewrite(cout, buf.cbuf, n);
cbp = buf.cbuf;
cbc = sizeof(buf.cbuf);
}
......@@ -1398,7 +1398,7 @@ datblk(int32 s, int32 n, int str)
break;
}
}
write(cout, buf.dbuf, n);
ewrite(cout, buf.dbuf, n);
}
void
......
......@@ -575,7 +575,7 @@ asmb(void)
if(dlm){
char buf[8];
write(cout, buf, INITDAT-textsize);
ewrite(cout, buf, INITDAT-textsize);
textsize = INITDAT;
}
......@@ -649,7 +649,7 @@ asmb(void)
cflush();
elfstro = seek(cout, 0, 1);
elfsymsize = elfstro - elfsymo;
write(cout, elfstrdat, elfstrsize);
ewrite(cout, elfstrdat, elfstrsize);
if(debug['v'])
Bprint(&bso, "%5.2f dwarf\n", cputime());
......@@ -938,7 +938,7 @@ cflush(void)
n = sizeof(buf.cbuf) - cbc;
if(n)
write(cout, buf.cbuf, n);
ewrite(cout, buf.cbuf, n);
cbp = buf.cbuf;
cbc = sizeof(buf.cbuf);
}
......@@ -1208,7 +1208,7 @@ datblk(int32 s, int32 n)
}
}
write(cout, buf.dbuf, n);
ewrite(cout, buf.dbuf, n);
if(!debug['a'])
return;
......
......@@ -604,7 +604,7 @@ asmb(void)
if(dlm){
char buf[8];
write(cout, buf, INITDAT-textsize);
ewrite(cout, buf, INITDAT-textsize);
textsize = INITDAT;
}
......@@ -1080,7 +1080,7 @@ cflush(void)
n = sizeof(buf.cbuf) - cbc;
if(n)
write(cout, buf.cbuf, n);
ewrite(cout, buf.cbuf, n);
cbp = buf.cbuf;
cbc = sizeof(buf.cbuf);
}
......@@ -1213,7 +1213,7 @@ datblk(int32 s, int32 n, int32 rodata)
}
}
write(cout, buf.dbuf, n);
ewrite(cout, buf.dbuf, n);
if(!debug['a'])
return;
......
......@@ -316,7 +316,7 @@ elfwriteinterp(void)
n = strlen(interp)+1;
seek(cout, ELFRESERVE-n, 0);
write(cout, interp, n);
ewrite(cout, interp, n);
return n;
}
......
......@@ -924,3 +924,12 @@ addsection(Segment *seg, char *name, int rwx)
*l = sect;
return sect;
}
void
ewrite(int fd, void *buf, int n)
{
if(write(fd, buf, n) < 0) {
diag("write error: %r");
errorexit();
}
}
......@@ -128,6 +128,7 @@ void ldpkg(Biobuf*, char*, int64, char*, int);
void mark(Sym *s);
char* expandpkg(char*, char*);
void deadcode(void);
void ewrite(int, void*, int);
int pathchar(void);
void* mal(uint32);
......
......@@ -430,8 +430,8 @@ domacholink(void)
}
}
write(cout, linkdata, nlinkdata);
write(cout, strtab, nstrtab);
ewrite(cout, linkdata, nlinkdata);
ewrite(cout, strtab, nstrtab);
}
return rnd(nlinkdata+nstrtab, INITRND);
}
......
......@@ -786,7 +786,8 @@ error:
goto done;
memset(buf, 0, sizeof buf);
seek(fd, sh[ep->shstrndx].offset, 0);
read(fd, buf, sh[ep->shstrndx].size);
i = read(fd, buf, sh[ep->shstrndx].size);
USED(i); // shut up ubuntu gcc
for(i = 0; i < ep->shnum; i++) {
if (strcmp(&buf[sh[i].name], ".gosymtab") == 0) {
......@@ -967,7 +968,8 @@ error:
goto done;
memset(buf, 0, sizeof buf);
seek(fd, sh[ep->shstrndx].offset, 0);
read(fd, buf, sh[ep->shstrndx].size);
i = read(fd, buf, sh[ep->shstrndx].size);
USED(i); // shut up ubuntu gcc
for(i = 0; i < ep->shnum; i++) {
if (strcmp(&buf[sh[i].name], ".gosymtab") == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment