From patchwork Tue Dec 9 18:58:17 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: spu-tools: Handle chdir return code From: Andre Detsch X-Patchwork-Id: 13028 Message-Id: <200812091658.17374.adetsch@br.ibm.com> To: cbe-oss-dev@ozlabs.org, herrend@de.ibm.com Date: Tue, 9 Dec 2008 16:58:17 -0200 Handle chdir return code to avoid trying to access tid, phys-id and stat files in the wrong location. Signed-off-by: Andre Detsch --- 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 + * 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 * ctx-info.c: Enhanced PID retrieval.