[SM-Commit] PERFORCE change 76801 by David Michael Leo Brown Jr. for review

Perforce Review Daemon p4review at smee.org
Sat Mar 25 22:10:00 EST 2006


Change 76801 by david_brown at dmlb2000-dmlb2004 on 2006/03/26 04:08:44

	still slimming down access function make it use the standard way files
	are status'd in installwatch and check against the return value

Affected files ...

... //sgl/grimoires/stage_root/utils/installwatch/HISTORY#11 edit
... //sgl/grimoires/stage_root/utils/installwatch/access-addition.patch#5 edit

Differences ...

==== //sgl/grimoires/stage_root/utils/installwatch/HISTORY#11 (text) ====

@@ -1,4 +1,8 @@
 2006-03-25 David Brown <dmlb2000 at gmail.com>
+	* access-addition.patch: fixed patch to make it look more like open when
+	  opening for read only using the status int from instw_getstatus
+	
+2006-03-25 David Brown <dmlb2000 at gmail.com>
 	* access-addition.patch: fixed patch to remove log function cause it's
 	  not needed.
 

==== //sgl/grimoires/stage_root/utils/installwatch/access-addition.patch#5 (text) ====

@@ -1,5 +1,5 @@
 diff --git a/installwatch-0.7.0beta4/installwatch.c b/installwatch-0.7.0beta4/installwatch.c
-index e2b2e9f..37bf326 100644
+index e2b2e9f..7db45c9 100644
 --- a/installwatch-0.7.0beta4/installwatch.c
 +++ b/installwatch-0.7.0beta4/installwatch.c
 @@ -91,6 +91,7 @@ static int (*true_truncate)(const char *
@@ -18,14 +18,14 @@
  
  #if(GLIBC_MINOR >= 1)
  	true_creat64     = dlsym(libc_handle, "creat64");
-@@ -3150,6 +3152,52 @@ int utimes (const char *pathname, const 
+@@ -3150,6 +3152,42 @@ int utimes (const char *pathname, const 
  	return result;
  }
  
 +int access (const char *pathname, int type) {
 +	int result;
 +	instw_t instw;
-+	int s_errno;
++	int status;
 +	
 +	if (!libc_handle)
 +		initialize();
@@ -48,22 +48,12 @@
 +	instw_print(&instw);
 +#endif
 +
-+	result=true_access(instw.translpath,type);
-+	if(result == -1 && errno == ENOENT)
-+	{
-+		/* first check if it's been removed and we should break out */
-+		s_errno = errno;
-+		result=true_access(instw.mtranslpath,type);
-+		if(result == 0)
-+		{
-+			errno = s_errno;
-+			result = -1;
-+		}
-+		else
-+		{
-+			result=true_access(pathname,type);
-+		}
-+	}
++        instw_getstatus(&instw,&status);
++        if(status&INSTW_TRANSLATED)
++		result=true_access(instw.translpath,type);
++	else
++		result=true_access(instw.path,type);
++	
 +	instw_delete(&instw);
 +	return result;
 +}



More information about the SM-Commit mailing list