[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r5090 - in GNUnet/src: include util/disk util/loggers
From: |
gnunet |
Subject: |
[GNUnet-SVN] r5090 - in GNUnet/src: include util/disk util/loggers |
Date: |
Sat, 16 Jun 2007 05:12:07 -0600 (MDT) |
Author: durner
Date: 2007-06-16 05:12:06 -0600 (Sat, 16 Jun 2007)
New Revision: 5090
Modified:
GNUnet/src/include/gnunet_util_disk.h
GNUnet/src/util/disk/storage.c
GNUnet/src/util/loggers/file.c
Log:
remove special chars from log file names
Modified: GNUnet/src/include/gnunet_util_disk.h
===================================================================
--- GNUnet/src/include/gnunet_util_disk.h 2007-06-16 10:39:18 UTC (rev
5089)
+++ GNUnet/src/include/gnunet_util_disk.h 2007-06-16 11:12:06 UTC (rev
5090)
@@ -192,6 +192,12 @@
int disk_directory_create(struct GE_Context * ectx,
const char * dir);
+/**
+ * @brief Removes special characters as ':' from a filename.
+ * @param fn the filename to canonicalize
+ */
+void disk_filename_canonicalize(char *fn);
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
Modified: GNUnet/src/util/disk/storage.c
===================================================================
--- GNUnet/src/util/disk/storage.c 2007-06-16 10:39:18 UTC (rev 5089)
+++ GNUnet/src/util/disk/storage.c 2007-06-16 11:12:06 UTC (rev 5090)
@@ -731,4 +731,25 @@
return SYSERR;
}
+/**
+ * @brief Removes special characters as ':' from a filename.
+ * @param fn the filename to canonicalize
+ */
+void disk_filename_canonicalize(char *fn) {
+ char *idx;
+ char c;
+
+ idx = fn;
+ while (*idx) {
+ c = *idx;
+
+ if (c == '/' || c == '\\' || c == ':' || c == '*' || c == '?' ||
+ c == '"' || c == '<' || c == '>' || c == '|') {
+ *idx = '_';
+ }
+
+ idx++;
+ }
+}
+
/* end of storage.c */
Modified: GNUnet/src/util/loggers/file.c
===================================================================
--- GNUnet/src/util/loggers/file.c 2007-06-16 10:39:18 UTC (rev 5089)
+++ GNUnet/src/util/loggers/file.c 2007-06-16 11:12:06 UTC (rev 5090)
@@ -191,6 +191,10 @@
datefmt,
&lcltime));
FREE(datefmt);
+
+ /* Remove special chars */
+ disk_filename_canonicalize(date);
+
size = strlen(name) + 82;
ret = MALLOC(size);
SNPRINTF(ret,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r5090 - in GNUnet/src: include util/disk util/loggers,
gnunet <=