mirror of
				https://git.proxmox.com/git/libgit2
				synced 2025-11-04 04:38:58 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			21 lines
		
	
	
		
			394 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			394 B
		
	
	
	
		
			C
		
	
	
	
	
	
#include "clay.h"
 | 
						|
#include "testlib.h"
 | 
						|
#include "posix.h"
 | 
						|
 | 
						|
void file_create(const char *filename, const char *content)
 | 
						|
{
 | 
						|
	int fd;
 | 
						|
 | 
						|
	fd = p_creat(filename, 0666);
 | 
						|
	cl_assert(fd != 0);
 | 
						|
 | 
						|
	if (content) {
 | 
						|
		cl_must_pass(p_write(fd, content, strlen(content)));
 | 
						|
	} else {
 | 
						|
		cl_must_pass(p_write(fd, filename, strlen(filename)));
 | 
						|
		cl_must_pass(p_write(fd, "\n", 1));
 | 
						|
	}
 | 
						|
 | 
						|
	cl_must_pass(p_close(fd));
 | 
						|
}
 |