<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
    <dl style="line-height: 1.5; margin-left: 2em">
      <dt style="clear: both; float: left; font-weight: bold; width: 8em">Author</dt>
      <dd style="margin-left: 8.5em">Kouhei Sutou &lt;kou****@clear*****&gt;</dd>
      <dt style="clear: both; float: left; font-weight: bold; width: 8em">Date</dt>
      <dd style="margin-left: 8.5em">2012-08-17 17:06:50 +0900 (Fri, 17 Aug 2012)</dd>
      <dt style="clear: both; float: left; font-weight: bold; width: 8em">New Revision</dt>
      <dd style="margin-left: 8.5em"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976">5f84e834a3edfb7470d0329dc391e2f1c9036976</a></dd>
      <dt style="clear: both; float: left; font-weight: bold; width: 8em">Log</dt>
      <dd style="margin-left: 8.5em"><pre style="border: 1px solid #aaa; font-family: Consolas, Menlo, &quot;Liberation Mono&quot;, Courier, monospace; line-height: 1.2; padding: 0.5em">windows: fix database open failure

O_BINARY is needed for opening database that contains binary data.

Reported by @yito. Thanks!!!</pre></dd>
      <dt style="clear: both; float: left; font-weight: bold; width: 8em">Modified files</dt>
      <dd style="margin-left: 8.5em">
        <ul>
          <li><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#diff-0">lib/io.c</a></li>
        </ul>
      </dd>
    </dl>

    <div class="diff-section" style="clear: both">
      <table style="border-collapse: collapse; border: 1px solid #aaa">
        <thead>
          <tr class="diff-header" style="border: 1px solid #aaa">
            <td colspan="3">
<pre style="border: 0; font-family: Consolas, Menlo, &quot;Liberation Mono&quot;, Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal"><span class="diff-header" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">  Modified: lib/io.c (+10 -2)</span>
<span class="diff-header-mark" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">===================================================================</span>
</pre>
            </td>
          </tr>
        </thead>
        <tbody>
          <tr>
            <th class="diff-line-number" style="border: 1px solid #aaa">
<pre style="border: 0; font-family: Consolas, Menlo, &quot;Liberation Mono&quot;, Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal"><span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L41">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L42">42</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L43">43</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L44">44</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L45">45</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L46">46</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L47">47</a></span>
<span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L380">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L381">381</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L382">382</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L383">383</a></span>
<span class="diff-line-number-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L384">384</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L385">385</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L386">386</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L387">387</a></span>
<span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L416">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L417">417</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L418">418</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L419">419</a></span>
<span class="diff-line-number-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L420">420</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L421">421</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L422">422</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0L423">423</a></span>
</pre>
            </th>
            <th class="diff-line-number" style="border: 1px solid #aaa">
<pre style="border: 0; font-family: Consolas, Menlo, &quot;Liberation Mono&quot;, Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal"><span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R41">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R42">42</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R43">43</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R44">44</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R45">45</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R46">46</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R47">47</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R48">48</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R49">49</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R50">50</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R51">51</a></span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R52">52</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R53">53</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R54">54</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R55">55</a></span>
<span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R388">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R389">389</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R390">390</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R391">391</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R392">392</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R393">393</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R394">394</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R395">395</a></span>
<span class="diff-line-number-hunk-header" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R424">...</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R425">425</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R426">426</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R427">427</a></span>
<span class="diff-line-number-nothing" style="display: block; white-space: pre">&nbsp;</span>
<span class="diff-line-number-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R428">428</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R429">429</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R430">430</a></span>
<span class="diff-line-number-not-changed" style="display: block; white-space: pre"><a href="https://github.com/groonga/groonga/commit/5f84e834a3edfb7470d0329dc391e2f1c9036976#L0R431">431</a></span>
</pre>
            </th>
            <td class="diff-content" style="border: 1px solid #aaa">
<pre style="border: 0; font-family: Consolas, Menlo, &quot;Liberation Mono&quot;, Courier, monospace; line-height: 1.2; margin: 0; padding: 0.5em; white-space: normal"><span class="diff-hunk-header" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">@@ -42,6 +42,14 @@</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> </span>
<span class="diff-not-changed" style="display: block; white-space: pre"> /* end VA hack */</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> </span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+#ifndef O_BINARY</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+# ifdef _O_BINARY</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+#  define O_BINARY _O_BINARY</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+# else</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+#  define O_BINARY 0</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+# endif</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+#endif</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> typedef struct _grn_io_fileinfo {</span>
<span class="diff-not-changed" style="display: block; white-space: pre"> #ifdef WIN32</span>
<span class="diff-not-changed" style="display: block; white-space: pre">   HANDLE fh;</span>
<span class="diff-hunk-header" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">@@ -381,7 +389,7 @@ <span class="diff-context" style="background-color: #ffffaa; color: #000000">grn_io_detect_type(grn_ctx *ctx, const char *path)</span></span>
<span class="diff-not-changed" style="display: block; white-space: pre"> {</span>
<span class="diff-not-changed" style="display: block; white-space: pre">   struct _grn_io_header h;</span>
<span class="diff-not-changed" style="display: block; white-space: pre">   uint32_t res = 0;</span>
<span class="diff-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre">-  int fd = GRN_OPEN(path, O_RDWR);</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+  int fd = GRN_OPEN(path, O_RDWR | O_BINARY);</span>
<span class="diff-not-changed" style="display: block; white-space: pre">   if (fd != -1) {</span>
<span class="diff-not-changed" style="display: block; white-space: pre">     struct stat s;</span>
<span class="diff-not-changed" style="display: block; white-space: pre">     if (fstat(fd, &amp;s) != -1 &amp;&amp; s.st_size &gt;= sizeof(struct _grn_io_header)) {</span>
<span class="diff-hunk-header" style="background-color: #eaf2f5; color: #999999; display: block; white-space: pre">@@ -417,7 +425,7 @@ <span class="diff-context" style="background-color: #ffffaa; color: #000000">grn_io_open(grn_ctx *ctx, const char *path, grn_io_mode mode)</span></span>
<span class="diff-not-changed" style="display: block; white-space: pre">   if (!path || !*path || (strlen(path) &gt; PATH_MAX - 4)) { return NULL; }</span>
<span class="diff-not-changed" style="display: block; white-space: pre">   {</span>
<span class="diff-not-changed" style="display: block; white-space: pre">     struct _grn_io_header h;</span>
<span class="diff-deleted" style="background-color: #ffaaaa; color: #000000; display: block; white-space: pre">-    int fd = GRN_OPEN(path, O_RDWR);</span>
<span class="diff-added" style="background-color: #aaffaa; color: #000000; display: block; white-space: pre">+    int fd = GRN_OPEN(path, O_RDWR | O_BINARY);</span>
<span class="diff-not-changed" style="display: block; white-space: pre">     if (fd == -1) { SERR(path); return NULL; }</span>
<span class="diff-not-changed" style="display: block; white-space: pre">     if (fstat(fd, &amp;s) != -1 &amp;&amp; s.st_size &gt;= sizeof(struct _grn_io_header)) {</span>
<span class="diff-not-changed" style="display: block; white-space: pre">       if (read(fd, &amp;h, sizeof(struct _grn_io_header)) == sizeof(struct _grn_io_header)) {</span>
</pre>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </body>
</html>