summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-09 07:19:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-09 07:19:43 +0000
commit92a04a491505e6e72630d10cdc952903e811d270 (patch)
tree57b6a421356fd3c8b472f1b146b60bb65923cdf2 /io.c
parent209314c274f3bdf8b7167ca0f9482fbf08cc9af6 (diff)
io.c: refine error message
* io.c (do_io_advise): more precise error message, with arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/io.c b/io.c
index 77460c9a59..731b3054f6 100644
--- a/io.c
+++ b/io.c
@@ -65,6 +65,13 @@
#if !HAVE_OFF_T && !defined(off_t)
# define off_t long
#endif
+#if SIZEOF_OFF_T > SIZEOF_LONG && defined(HAVE_LONG_LONG)
+# define PRI_OFF_T_PREFIX "ll"
+#elif SIZEOF_OFF_T == SIZEOF_LONG
+# define PRI_OFF_T_PREFIX "l"
+#else
+# define PRI_OFF_T_PREFIX ""
+#endif
#include <sys/stat.h>
@@ -8507,7 +8514,12 @@ do_io_advise(rb_io_t *fptr, VALUE advice, off_t offset, off_t len)
if (rv) {
/* posix_fadvise(2) doesn't set errno. On success it returns 0; otherwise
it returns the error code. */
- rb_syserr_fail_str(rv, fptr->pathv);
+ VALUE message = rb_sprintf("%"PRIsVALUE" "
+ "(%"PRI_OFF_T_PREFIX"d, "
+ "%"PRI_OFF_T_PREFIX"d, "
+ "%"PRIsVALUE")",
+ fptr->pathv, offset, len, advice);
+ rb_syserr_fail_str(rv, message);
}
return Qnil;