about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--Src/Modules/attr.c8
-rw-r--r--Src/builtin.c6
3 files changed, 16 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 55f558e75..0026f6b4a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-11-06  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 27358: Src/builtin.c: error if $0 was altered within
+	a sourced file.
+
+	* 27357: Src/Modules/attr.c: fix compiler warnings
+
 2009-11-06  Peter Stephenson  <pws@csr.com>
 
         * Frank Terbeck: 27353: Functions/VCS_Info/VCS_INFO_bydir_detect,
@@ -12301,5 +12308,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4803 $
+* $Revision: 1.4804 $
 *****************************************************
diff --git a/Src/Modules/attr.c b/Src/Modules/attr.c
index 72348623a..2cdb522c1 100644
--- a/Src/Modules/attr.c
+++ b/Src/Modules/attr.c
@@ -42,7 +42,7 @@ xgetxattr(const char *path, const char *name, void *value, size_t size, int syml
     switch (symlink) {
     case 0:
         return getxattr(path, name, value, size);
-    case 1:
+    default:
         return lgetxattr(path, name, value, size);
     }
 #endif
@@ -57,7 +57,7 @@ xlistxattr(const char *path, char *list, size_t size, int symlink)
     switch (symlink) {
     case 0:
         return listxattr(path, list, size);
-    case 1:
+    default:
         return llistxattr(path, list, size);
     }
 #endif
@@ -73,7 +73,7 @@ xsetxattr(const char *path, const char *name, const void *value,
     switch (symlink) {
     case 0:
         return setxattr(path, name, value, size, flags);
-    case 1:
+    default:
         return lsetxattr(path, name, value, size, flags);
     }
 #endif
@@ -88,7 +88,7 @@ xremovexattr(const char *path, const char *name, int symlink)
     switch (symlink) {
     case 0:
         return removexattr(path, name);
-    case 1:
+    default:
         return lremovexattr(path, name);
     }
 #endif
diff --git a/Src/builtin.c b/Src/builtin.c
index f032230b6..47b201264 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4747,7 +4747,7 @@ bin_dot(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
     enam = arg0 = ztrdup(*argv);
     if (isset(FUNCTIONARGZERO)) {
 	old0 = argzero;
-	argzero = arg0;
+	argzero = ztrdup(arg0);
     }
     s = unmeta(enam);
     errno = ENOENT;
@@ -4802,8 +4802,10 @@ bin_dot(char *name, char **argv, UNUSED(Options ops), UNUSED(int func))
     if (ret == SOURCE_NOT_FOUND)
 	zwarnnam(name, "%e: %s", errno, enam);
     zsfree(arg0);
-    if (old0)
+    if (old0) {
+	zsfree(argzero);
 	argzero = old0;
+    }
     return ret == SOURCE_OK ? lastval : 128 - ret;
 }