perror(mmap_file);
return errno;
}
- ftruncate(fd, region);
+ if (ftruncate(fd, region) < 0) {
+ perror("ftruncate()");
+ rc = errno;
+ goto out_close;
+ }
ptr = mmap(NULL, region, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (ptr == MAP_FAILED) {
perror(mmap_file);
return errno;
}
- ftruncate(fd, page_size);
+ if (ftruncate(fd, page_size) < 0) {
+ perror("ftruncate()");
+ rc = errno;
+ goto out_close;
+ }
ptr = mmap(NULL, page_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
if (ptr == MAP_FAILED) {
perror(mmap_file);
return errno;
}
- ftruncate(fd, region);
+ if (ftruncate(fd, region) < 0) {
+ perror("ftruncate()");
+ rc = errno;
+ goto out_close;
+ }
ptr = mmap(NULL, region, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (ptr == MAP_FAILED) {
perror(fileb);
return errno;
}
- ftruncate(fdr, region);
+ if (ftruncate(fdr, region) < 0) {
+ perror("ftruncate()");
+ rc = errno;
+ goto out_close;
+ }
fdw = open(filea, O_CREAT|O_RDWR, 0600);
if (fdw < 0) {
perror(filea);
rc = errno;
goto out_close;
}
- ftruncate(fdw, region);
+ if (ftruncate(fdw, region) < 0) {
+ perror("ftruncate()");
+ rc = errno;
+ goto out_close;
+ }
ptr = mmap(NULL, region, PROT_READ|PROT_WRITE, MAP_SHARED, fdr, 0);
if (ptr == MAP_FAILED) {
perror(mmap_file);
return errno;
}
- ftruncate(fd, region);
+ if (ftruncate(fd, region) < 0) {
+ perror("ftruncate()");
+ rc = errno;
+ goto out_close;
+ }
ptr = mmap(NULL, region, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (ptr == MAP_FAILED) {
perror(mmap_file);
return errno;
}
- ftruncate(fd, page_size);
+ if (ftruncate(fd, page_size) < 0) {
+ perror("ftruncate()");
+ rc = errno;
+ goto out;
+ }
fd2 = open(mmap_file2, O_RDWR, 0600);
if (fd2 < 0) {