Unexpected temporary directory

Yasuhiro MATSUMOTO <[email protected]> Tue, 4 Mar 2014 21:59:52 +0900
Newsgroups gmane.comp.ipod.gtkpod
Message-ID <CAJc+XFM_2igdp50cramF1vP7kgwzbXfXBFW94eb0fT3rGvLy+Q@mail.gmail.com>
--===============5803242854081389505==
Content-Type: multipart/alternative; boundary=001a1134541ae274f704f3c77a0d

--001a1134541ae274f704f3c77a0d
Content-Type: text/plain; charset=UTF-8

Hi.

libgpod manipulate sqlite3 db in temporary directory. But the temporary
directory is unexpected.

  tmpdir = g_build_path(g_get_tmp_dir(), tmpnam(NULL), NULL);

This doesn't work correctly. IFAIK, g_build_path take path separator for
first argument. And if want to make temporary directory, it should be call
like follow.

  tmpdir = g_build_path(G_DIR_SEPARATOR_S, g_get_tmp_dir(), ...);

I noticed one more bug. tmpnam(NULL) returns full path string on POSIX
environment. For example:

UNIX:
  ex: /tmp/a2aja35

Windows:
  ex: \2s5s.

I guess that this is not expected. Below is a patch. Please check and
include.
BTW, Right now, I came to be able to transfer the music in windows with
this patch. :)

https://gist.github.com/mattn/9345867


-- 
- Yasuhiro Matsumoto

--001a1134541ae274f704f3c77a0d
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi.<br></div><div><br></div><div>libgpod manipulate s=
qlite3 db in temporary directory. But the temporary directory is unexpected=
.</div><div><br></div><div>=C2=A0 tmpdir =3D g_build_path(g_get_tmp_dir(), =
tmpnam(NULL), NULL);</div>
<div><br></div><div>This doesn&#39;t work correctly. IFAIK, g_build_path ta=
ke path separator for first argument. And if want to make temporary directo=
ry, it should be call like follow.</div><div><br></div><div>=C2=A0 tmpdir =
=3D g_build_path(G_DIR_SEPARATOR_S, g_get_tmp_dir(), ...);</div>
<div><br></div><div>I noticed one more bug. tmpnam(NULL) returns full path =
string on POSIX environment. For example:</div><div><br></div><div>UNIX:</d=
iv><div>=C2=A0 ex: /tmp/a2aja35</div><div><br></div><div>Windows:</div><div=
>
=C2=A0 ex: \2s5s.</div><div><br></div><div>I guess that this is not expecte=
d. Below is a patch. Please check and include.</div><div>BTW, Right now, I =
came to be able to transfer the music in windows with this patch. :)</div><=
div>
<br></div><div><a href=3D"https://gist.github.com/mattn/9345867">https://gi=
st.github.com/mattn/9345867</a></div><div><br></div><div><br></div>-- <br>-=
 Yasuhiro Matsumoto<br>
</div>

--001a1134541ae274f704f3c77a0d--


--===============5803242854081389505==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
--===============5803242854081389505==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Gtkpod-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-devel

--===============5803242854081389505==--