diff options
| author | sghctoma <sghctoma@gmail.com> | 2018-11-09 18:29:19 +0100 | 
|---|---|---|
| committer | sghctoma <sghctoma@gmail.com> | 2018-11-09 18:29:19 +0100 | 
| commit | bc5e84225c4ccf1a7a7cfa51533c80338fc85635 (patch) | |
| tree | fbc531b8be5cb7ef63b86e16e47260d57814d2bc | |
| parent | b25e230df828ded199d5648380a273ebbd3c5607 (diff) | |
| download | wlroots-bc5e84225c4ccf1a7a7cfa51533c80338fc85635.tar.xz | |
Use ftruncate to set shared memory object's size
The posix_fallocate function should only be used with regular files.
| -rw-r--r-- | util/shm.c | 12 | 
1 files changed, 0 insertions, 12 deletions
| @@ -42,17 +42,6 @@ int allocate_shm_file(size_t size) {  		return -1;  	} -#if defined(WLR_HAS_POSIX_FALLOCATE) && !defined(__FreeBSD__) -	int ret; -	do { -		ret = posix_fallocate(fd, 0, size); -	} while (ret == EINTR); -	if (ret != 0) { -		close(fd); -		errno = ret; -		return -1; -	} -#else  	int ret;  	do {  		ret = ftruncate(fd, size); @@ -61,7 +50,6 @@ int allocate_shm_file(size_t size) {  		close(fd);  		return -1;  	} -#endif  	return fd;  } | 
