mem.c (5c34202b8bf942da411b6599668a76b07449bbfd) | mem.c (512b6fb1c14d4c34f23a3419b0789ad01914a899) |
---|---|
1#include <stdio.h> 2#include <stdlib.h> 3#include <stddef.h> 4#include <stdarg.h> 5#include <unistd.h> 6#include <errno.h> 7#include <string.h> 8#include <fcntl.h> --- 204 unchanged lines hidden (view full) --- 213 214 fd = make_tempfile(TEMPNAME_TEMPLATE, NULL, 1); 215 if(fd < 0) { 216 exit(1); 217 } 218 219 err = fchmod(fd, 0777); 220 if(err < 0){ | 1#include <stdio.h> 2#include <stdlib.h> 3#include <stddef.h> 4#include <stdarg.h> 5#include <unistd.h> 6#include <errno.h> 7#include <string.h> 8#include <fcntl.h> --- 204 unchanged lines hidden (view full) --- 213 214 fd = make_tempfile(TEMPNAME_TEMPLATE, NULL, 1); 215 if(fd < 0) { 216 exit(1); 217 } 218 219 err = fchmod(fd, 0777); 220 if(err < 0){ |
221 perror("os_mode_fd"); | 221 perror("fchmod"); |
222 exit(1); 223 } 224 225 /* Seek to len - 1 because writing a character there will 226 * increase the file size by one byte, to the desired length. 227 */ 228 if (lseek64(fd, len - 1, SEEK_SET) < 0) { | 222 exit(1); 223 } 224 225 /* Seek to len - 1 because writing a character there will 226 * increase the file size by one byte, to the desired length. 227 */ 228 if (lseek64(fd, len - 1, SEEK_SET) < 0) { |
229 perror("os_seek_file"); | 229 perror("lseek64"); |
230 exit(1); 231 } 232 233 zero = 0; 234 235 err = write(fd, &zero, 1); 236 if(err != 1){ 237 perror("write"); --- 4 unchanged lines hidden (view full) --- 242} 243 244int __init create_mem_file(unsigned long long len) 245{ 246 int err, fd; 247 248 fd = create_tmp_file(len); 249 | 230 exit(1); 231 } 232 233 zero = 0; 234 235 err = write(fd, &zero, 1); 236 if(err != 1){ 237 perror("write"); --- 4 unchanged lines hidden (view full) --- 242} 243 244int __init create_mem_file(unsigned long long len) 245{ 246 int err, fd; 247 248 fd = create_tmp_file(len); 249 |
250 err = os_set_exec_close(fd, 1); | 250 err = os_set_exec_close(fd); |
251 if(err < 0){ 252 errno = -err; 253 perror("exec_close"); 254 } 255 return fd; 256} 257 258 --- 21 unchanged lines hidden --- | 251 if(err < 0){ 252 errno = -err; 253 perror("exec_close"); 254 } 255 return fd; 256} 257 258 --- 21 unchanged lines hidden --- |