aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrunchy <crunchy>2002-09-15 20:07:10 +0000
committercrunchy <crunchy>2002-09-15 20:07:10 +0000
commit4df6b1b934bfebe30b135ed855fefe3191cf605b (patch)
tree4aa60fb0d037e23dde8f3476955270a04d0889c2
parent38734679e4a63712715368e95081cd21a2d0d1d1 (diff)
downloadmpiosh-4df6b1b934bfebe30b135ed855fefe3191cf605b.tar.gz
mpiosh-4df6b1b934bfebe30b135ed855fefe3191cf605b.tar.bz2
mpiosh-4df6b1b934bfebe30b135ed855fefe3191cf605b.zip
bug fix for ldir (hopefully)
-rw-r--r--ChangeLog9
-rw-r--r--mpiosh/callback.c40
2 files changed, 31 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index bb20637..de95802 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2002-09-15 Andreas Buesching <crunchy@tzi.de>
+ * mpiosh/callback.c (mpiosh_cmd_ldir): checking more return values
+ to avoid segmentation faults.
+
+ * mpiosh/mpiosh.c: removed all references to the not implemented
+ switch command (just for the next release)
+
+ * configure.in (MODULE_PATH): checking for the right module
+ directory and use it to install the mpio module
+
* kernel/Makefile.am (install): the kernel module is now installed
into the determinated module directory of the current kernel
version.
diff --git a/mpiosh/callback.c b/mpiosh/callback.c
index ca89a82..74a4567 100644
--- a/mpiosh/callback.c
+++ b/mpiosh/callback.c
@@ -2,7 +2,7 @@
*
* Author: Andreas Büsching <crunchy@tzi.de>
*
- * $Id: callback.c,v 1.7 2002/09/15 12:03:23 germeier Exp $
+ * $Id: callback.c,v 1.8 2002/09/15 20:07:10 crunchy Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -558,27 +558,31 @@ mpiosh_cmd_ldir(char *args[])
run = dentry;
rights[10] = '\0';
for (i = 0; i < count; i++, run++) {
- stat((*run)->d_name, &st);
-
- rights[0] = *("?pc?dnb?-?l?s???" + (st.st_mode >> 12 & 0xf));
- for (j = 0; j < 9; j++) {
- if (st.st_mode & 1 << (8 - j))
- rights[j + 1] = "rwxrwxrwx"[j];
- else
- rights[j + 1] = '-';
- }
+ if (stat((*run)->d_name, &st) == -1) {
+ perror("stat");
+ } else {
+ rights[0] = *("?pc?dnb?-?l?s???" + (st.st_mode >> 12 & 0xf));
+ for (j = 0; j < 9; j++) {
+ if (st.st_mode & 1 << (8 - j))
+ rights[j + 1] = "rwxrwxrwx"[j];
+ else
+ rights[j + 1] = '-';
+ }
- pwd = getpwuid(st.st_uid);
- grp = getgrgid(st.st_gid);
- strftime(time, 12, "%b %2d", localtime(&(st.st_mtime)));
- printf("%s %8s %8s %8d %10s %s\n",
- rights, pwd->pw_name, grp->gr_name, (int)st.st_size,
- time,
- (*run)->d_name);
+ pwd = getpwuid(st.st_uid);
+ grp = getgrgid(st.st_gid);
+ strftime(time, 12, "%b %2d", localtime(&(st.st_mtime)));
+ printf("%s %8s %8s %8d %10s %s\n",
+ rights, pwd->pw_name, grp->gr_name, (int)st.st_size,
+ time,
+ (*run)->d_name);
+ }
free(*run);
}
free(dentry);
- }
+ } else {
+ perror("scandir");
+ }
}
}