[Mono-bugs] [Bug 489019] mono throwing exception while closing file descriptor 0
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Sat Mar 28 10:08:15 EDT 2009
https://bugzilla.novell.com/show_bug.cgi?id=489019
User gonzalo at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=489019#c3
--- Comment #3 from Gonzalo Paniagua Javier <gonzalo at novell.com> 2009-03-28 08:08:14 MST ---
Compile as: "gcc -o caller caller.c" and "gmcs main.cs".
Then run: ./caller
Adjust the path to 'mono' (or use another exec* that searches in PATH).
The result will be an empty "test-file.log" or an exception, depending on the
version of mono.
----caller.c--------------
#include <unistd.h>
int
main ()
{
close (0);
close (1);
close (2);
return execlp ("/opt/mono/bin/mono", "/opt/mono/bin/mono", "main.exe",
NULL);
}
-------------------------
------main.cs------------
using System;
using System.IO;
class Seomething
{
static private int done = 0;
static StreamWriter log = null;
public static void mylog(string msg)
{
if (done == 0) {
log = new StreamWriter("mylogfile.log");
done = 1;
}
log.Write(msg);
log.Flush();
}
public static void Main(string[] args)
{
StreamWriter w = new StreamWriter("test-file.log");
w.Write("Hello world");
w.Flush();
try
{
w.Close();
}
catch (Exception e)
{
mylog("StreamWriter.Close() threw exception\n");
mylog(e.ToString());
}
}
}
---------------------------------
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list