On Thu, May 28, 2015 at 3:03 AM, Torsten Bögershausen wrote:
> On 2015-05-27 15.33, Paul Tan wrote:
>> +/**
>> + * xopen() is the same as open(), but it die()s if the open() fails.
>> + */
>> +int xopen(const char *path, int flags, mode_t mode)
>> +{
>> + int fd;
>> +
>> + assert(path);
>>
On Thu, May 28, 2015 at 5:53 AM, Jeff King wrote:
> On Wed, May 27, 2015 at 09:03:47PM +0200, Torsten Bögershausen wrote:
>
>> The original open can take 2 or 3 parameters, how about this:
>> int xopen(const char *path, int oflag, ... )
>> {
>> va_list params;
>> int mode;
>>
On Wed, May 27, 2015 at 09:03:47PM +0200, Torsten Bögershausen wrote:
> The original open can take 2 or 3 parameters, how about this:
> int xopen(const char *path, int oflag, ... )
> {
> va_list params;
> int mode;
> int fd;
>
> va_start(params, oflag);
> m
On 2015-05-27 15.33, Paul Tan wrote:
> A common usage pattern of open() is to check if it was successful, and
> die() if it was not:
>
> int fd = open(path, O_WRONLY | O_CREAT, 0777);
> if (fd < 0)
> die_errno(_("Could not open '%s' for writing."), path);
>
> Implement a
On Wed, May 27, 2015 at 6:33 AM, Paul Tan wrote:
> A common usage pattern of open() is to check if it was successful, and
> die() if it was not:
>
> int fd = open(path, O_WRONLY | O_CREAT, 0777);
> if (fd < 0)
> die_errno(_("Could not open '%s' for writing."), path)
A common usage pattern of open() is to check if it was successful, and
die() if it was not:
int fd = open(path, O_WRONLY | O_CREAT, 0777);
if (fd < 0)
die_errno(_("Could not open '%s' for writing."), path);
Implement a wrapper function xopen() that does the above s
6 matches
Mail list logo