[dahdi-commits] tzafrir: branch tools/tzafrir/sysfs r8772 -	/tools/team/tzafrir/sysfs/
    SVN commits to the DAHDI project 
    dahdi-commits at lists.digium.com
       
    Mon Jun 14 17:38:08 CDT 2010
    
    
  
Author: tzafrir
Date: Mon Jun 14 17:38:04 2010
New Revision: 8772
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8772
Log:
dahdi_cfg bugfix: Replace access() with stat():
* Access fails if it's not a file (e.g: for a symlink)
* We don't want this. We only want a preliminary check that
  something exists.
Modified:
    tools/team/tzafrir/sysfs/dahdi_cfg.c
Modified: tools/team/tzafrir/sysfs/dahdi_cfg.c
URL: http://svnview.digium.com/svn/dahdi/tools/team/tzafrir/sysfs/dahdi_cfg.c?view=diff&rev=8772&r1=8771&r2=8772
==============================================================================
--- tools/team/tzafrir/sysfs/dahdi_cfg.c (original)
+++ tools/team/tzafrir/sysfs/dahdi_cfg.c Mon Jun 14 17:38:04 2010
@@ -552,6 +552,8 @@
 	snprintf(prefix, sizeof(prefix), "/dev/dahdi/%s", argstr);
 	pname = strrchr(prefix, '!');
 	if (pname) {
+		struct stat stbuf;
+
 		*pname = '\0';
 		in_span = span_string2num(prefix);
 		if(in_span <= 0) {
@@ -563,8 +565,8 @@
 		argstr = pname + 1;
 		str_replace(prefix, '!', '/');
 		pname = prefix;
-		if (access(pname, F_OK) < 0) {
-			error("Missing '%s'\n", pname);
+		if (stat(pname, &stbuf) < 0) {
+			error("Cannot access '%s': %s\n", pname, strerror(errno));
 			return -1;
 		}
 	}
    
    
More information about the dahdi-commits
mailing list