okay, after considering the words of a certain frenchman we no longer write anything to new files

SVN revision: 80629
This commit is contained in:
Mike Blumenkrantz 2012-12-11 07:50:06 +00:00
parent 762b170e75
commit 370ba1b3fe
1 changed files with 7 additions and 9 deletions

View File

@ -9192,18 +9192,17 @@ _e_fm2_new_file_thread(void *data __UNUSED__, Ecore_Thread *eth)
const char *path; const char *path;
struct stat st; struct stat st;
unsigned int x; unsigned int x;
FILE *f; int fd;
path = ecore_thread_global_data_wait("path", 2.0); path = ecore_thread_global_data_wait("path", 2.0);
snprintf(buf, sizeof(buf), "%s/%s", path, _("New File")); snprintf(buf, sizeof(buf), "%s/%s", path, _("New File"));
errno = 0; errno = 0;
if (stat(buf, &st) && (errno == ENOENT)) if (stat(buf, &st) && (errno == ENOENT))
{ {
f = fopen(buf, "w"); fd = open(buf, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR | S_IWUSR);
if (f) if (fd)
{ {
fwrite("\n", 1, 1, f); close(fd);
fclose(f);
ecore_thread_feedback(eth, strdup(buf)); ecore_thread_feedback(eth, strdup(buf));
return; return;
} }
@ -9217,11 +9216,10 @@ _e_fm2_new_file_thread(void *data __UNUSED__, Ecore_Thread *eth)
errno = 0; errno = 0;
if (stat(buf, &st) && (errno == ENOENT)) if (stat(buf, &st) && (errno == ENOENT))
{ {
f = fopen(buf, "w"); fd = creat(buf, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR | S_IWUSR);
if (f) if (fd)
{ {
fwrite("\n", 1, 1, f); close(fd);
fclose(f);
ecore_thread_feedback(eth, strdup(buf)); ecore_thread_feedback(eth, strdup(buf));
return; return;
} }