On Thu, Jun 25, 2015 at 2:39 AM, Johannes Schindelin
johannes.schinde...@gmx.de wrote:
IMO the varargs make the code more cumbersome to read (and even fragile,
because you can easily call `xopen(path, O_WRITE | O_CREATE)` and would not
even get so much as a compiler warning!)
I think that
On Wed, Jul 1, 2015 at 5:41 PM, Paul Tan pyoka...@gmail.com wrote:
Good point, I agree with this. I'll look into putting the error messages back.
This should work I think. It should take into account that O_RDONLY,
O_WRONLY, O_RDWR is defines as 0, 1, 2 on glibc, while the POSIX spec
also
Hi Paul,
On 2015-06-18 13:25, Paul Tan wrote:
diff --git a/git-compat-util.h b/git-compat-util.h
index 0cc7ae8..bc77d77 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -719,6 +719,7 @@ extern void *xrealloc(void *ptr, size_t size);
extern void *xcalloc(size_t nmemb, size_t
On Wed, Jun 24, 2015 at 9:28 AM, Johannes Schindelin
johannes.schinde...@gmx.de wrote:
Hi Paul,
On 2015-06-18 13:25, Paul Tan wrote:
diff --git a/git-compat-util.h b/git-compat-util.h
index 0cc7ae8..bc77d77 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -719,6 +719,7 @@ extern
Hi Stefan,
On 2015-06-24 18:59, Stefan Beller wrote:
On Wed, Jun 24, 2015 at 9:28 AM, Johannes Schindelin
johannes.schinde...@gmx.de wrote:
On 2015-06-18 13:25, Paul Tan wrote:
+ int fd = open(path, oflag, mode);
+ if (fd = 0)
+ return fd;
+
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 so
6 matches
Mail list logo