Enlightenment CVS committal
Author : sebastid
Project : e17
Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_desktop
Modified Files:
ecore_desktop.c
Log Message:
Use strncpy to get HOME copy.
Strip all trailing slashes.
===================================================================
RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_desktop/ecore_desktop.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- ecore_desktop.c 20 Aug 2006 03:45:53 -0000 1.11
+++ ecore_desktop.c 21 Aug 2006 17:54:22 -0000 1.12
@@ -1,3 +1,6 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
#include <ctype.h>
#include "Ecore_Desktop.h"
@@ -454,23 +457,23 @@
* @return The users howe directory.
* @ingroup Ecore_Desktop_Main_Group
*/
-char *
+char *
ecore_desktop_home_get()
{
char *d;
- int length;
char home[PATH_MAX];
/* Get Home Dir, check for trailing '/', strip it */
- snprintf(home, sizeof(home), "%s", getenv("HOME"));
+ strncpy(home, getenv("HOME"), PATH_MAX);
d = strrchr(home, '/');
if (d)
{
- if (strlen(d) == 1)
+ while (*d == '/')
{
- if (home[(length = strlen(home) - 1)] == '/')
- home[length] = '\0';
+ *d = 0;
+ d--;
}
}
+
return strdup(home);
}
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs