[Cbe-oss-dev] spu-tools: Handle chdir return code

Andre Detsch adetsch at br.ibm.com
Wed Dec 10 05:58:17 EST 2008


Handle chdir return code to avoid trying to access
tid, phys-id and stat files in the wrong location.

Signed-off-by: Andre Detsch <adetsch at br.ibm.com>

--
Dirk, can you please apply it to SVN?

Thanks,

Index: spu-tools/src/ctx-info.c
===================================================================
--- spu-tools.orig/src/ctx-info.c
+++ spu-tools/src/ctx-info.c
@@ -340,7 +340,9 @@ process_ctx_entry(struct dirent *entry, 
 		sprintf(buf, "%s/%s/%s", SPUFS_PATH, gang_name, entry->d_name);
 	else
 		sprintf(buf, "%s/%s", SPUFS_PATH, entry->d_name);
-	chdir(buf);
+
+	if (chdir(buf))
+		return 0;
 
 	fp = fopen("tid", "r");
 	if (fp) {
Index: spu-tools/src/ChangeLog
===================================================================
--- spu-tools.orig/src/ChangeLog
+++ spu-tools/src/ChangeLog
@@ -1,3 +1,7 @@
+2008-12-09 Andre Detsch <adetsch at br.ibm.com>
+	* ctx-info.c: Handle chdir return code, to avoid trying to access
+	tid, phys-id and stat files in the wrong location.
+
 2008-09-02 Andre Detsch <adetsch at br.ibm.com>
 	* ctx-info.c: Enhanced PID retrieval.
 



More information about the cbe-oss-dev mailing list