[前][次][番号順一覧][スレッド一覧]

ruby-changes:34683

From: nobu <ko1@a...>
Date: Wed, 9 Jul 2014 16:20:13 +0900 (JST)
Subject: [ruby-changes:34683] nobu:r46766 (trunk): io.c: refine error message

nobu	2014-07-09 16:19:43 +0900 (Wed, 09 Jul 2014)

  New Revision: 46766

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46766

  Log:
    io.c: refine error message
    
    * io.c (do_io_advise): more precise error message, with arguments.

  Modified files:
    trunk/io.c
Index: io.c
===================================================================
--- io.c	(revision 46765)
+++ io.c	(revision 46766)
@@ -65,6 +65,13 @@ https://github.com/ruby/ruby/blob/trunk/io.c#L65
 #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 https://github.com/ruby/ruby/blob/trunk/io.c#L8514
     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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]