projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
comments-dialog: Avoid segfault in comments dialog pasting very long text.
[pspp]
/
src
/
data
/
file-name.c
diff --git
a/src/data/file-name.c
b/src/data/file-name.c
index e3047a3354cd3506917cefcb3e0a23587138981c..9eeb4b1cfc06309e45c0777ef1277aa0fbeb4894 100644
(file)
--- a/
src/data/file-name.c
+++ b/
src/data/file-name.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006, 2007, 2009, 2010
, 2011
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-27,12
+27,13
@@
#include <unistd.h>
#include "data/settings.h"
#include <unistd.h>
#include "data/settings.h"
-#include "libpspp/hash.h"
+#include "libpspp/hash
-functions
.h"
#include "libpspp/message.h"
#include "libpspp/str.h"
#include "libpspp/version.h"
#include "gl/dirname.h"
#include "libpspp/message.h"
#include "libpspp/str.h"
#include "libpspp/version.h"
#include "gl/dirname.h"
+#include "gl/dosname.h"
#include "gl/intprops.h"
#include "gl/minmax.h"
#include "gl/relocatable.h"
#include "gl/intprops.h"
#include "gl/minmax.h"
#include "gl/relocatable.h"
@@
-127,12
+128,16
@@
fn_is_special (const char *file_name)
return false;
}
return false;
}
-/* Returns true if file with name NAME exists. */
+/* Returns true if file with name NAME exists, and that file is not a
+ directory */
bool
fn_exists (const char *name)
{
struct stat temp;
bool
fn_exists (const char *name)
{
struct stat temp;
- return stat (name, &temp) == 0;
+ if ( stat (name, &temp) != 0 )
+ return false;
+
+ return ! S_ISDIR (temp.st_mode);
}
\f
/* Environment variables. */
}
\f
/* Environment variables. */
@@
-221,14
+226,7
@@
fn_open (const char *fn, const char *mode)
}
else
#endif
}
else
#endif
- {
- FILE *f = fopen (fn, mode);
-
- if (f && mode[0] != 'r')
- setvbuf (f, NULL, _IOLBF, 0);
-
- return f;
- }
+ return fopen (fn, mode);
}
/* Counterpart to fn_open that closes file F with name FN; returns 0
}
/* Counterpart to fn_open that closes file F with name FN; returns 0