* libamu/xutil.c (xsnprintf): "unsafe" alternative to vsnprintf is am-utils-6_1_1
authorErez Zadok <ezk@cs.sunysb.edu>
Wed, 3 Aug 2005 02:14:26 +0000 (02:14 +0000)
committerErez Zadok <ezk@cs.sunysb.edu>
Wed, 3 Aug 2005 02:14:26 +0000 (02:14 +0000)
vsprintf, not sprintf.

* conf/umount/umount_osf.c (umount_fs): refer to proper formal
parameter name.
(umount2_fs): pass second arg to umount().

ChangeLog
conf/umount/umount_osf.c
libamu/xutil.c

index f26ea62a6466782d9100d3c37134f1ce64aaf53a..ddc5200d1f791446c3154799088a1a733034ec99 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,13 @@
        *** Released am-utils-6.1.1                                     ***
        *******************************************************************
 
+       * libamu/xutil.c (xsnprintf): "unsafe" alternative to vsnprintf is
+       vsprintf, not sprintf.
+
+       * conf/umount/umount_osf.c (umount_fs): refer to proper formal
+       parameter name.
+       (umount2_fs): pass second arg to umount().
+
        * ALL: remove CVS ID and put actual file name in source.
 
        * conf/autofs/*.[hc]: proper copyright headers.
index 02f4c170899802be8b149a5d87b42b27856d4a66..182ec10ccaaea6ae6f185aef93a408090380236c 100644 (file)
 
 
 int
-umount_fs(char *fs_name, const char *mnttabname, u_int unmount_flags)
+umount_fs(char *mntdir, const char *mnttabname, u_int unmount_flags)
 {
   int error;
 
 eintr:
-  error = umount(fs_name, MNT_NOFORCE);
+  error = umount(mntdir, MNT_NOFORCE);
   if (error < 0)
     error = errno;
 
   switch (error) {
   case EINVAL:
   case ENOTBLK:
-    plog(XLOG_WARNING, "unmount: %s is not mounted", fs_name);
+    plog(XLOG_WARNING, "unmount: %s is not mounted", mntdir);
     error = 0;                 /* Not really an error */
     break;
 
   case ENOENT:
-    plog(XLOG_ERROR, "mount point %s: %m", fs_name);
+    plog(XLOG_ERROR, "mount point %s: %m", mntdir);
     break;
 
   case EINTR:
     /* not sure why this happens, but it does.  ask kirk one day... */
-    dlog("%s: unmount: %m", fs_name);
+    dlog("%s: unmount: %m", mntdir);
     goto eintr;
 
 #ifdef MNT2_GEN_OPT_FORCE
@@ -85,7 +85,7 @@ eintr:
     /* caller determines if forced unmounts should be used */
     if (unmount_flags & AMU_UMOUNT_FORCE) {
       error = umount2_fs(mntdir, unmount_flags);
-      if ((error = umount2_fs(mntdir)) < 0)
+      if ((error = umount2_fs(mntdir, unmount_flags)) < 0)
        error = errno;
       else
        return error;
@@ -94,7 +94,7 @@ eintr:
 #endif /* MNT2_GEN_OPT_FORCE */
 
   default:
-    dlog("%s: unmount: %m", fs_name);
+    dlog("%s: unmount: %m", mntdir);
     break;
   }
 
@@ -110,7 +110,7 @@ umount2_fs(const char *mntdir, u_int unmount_flags)
   int error = 0;
   if (unmount_flags & AMU_UMOUNT_FORCE) {
     plog(XLOG_INFO, "umount2_fs: trying unmount/forced on %s", mntdir);
-    error = umount(mntdir, MNT2_GEN_OPT_FORCE);
+    error = umount((char *)mntdir, MNT2_GEN_OPT_FORCE);
     if (error < 0 && (errno == EINVAL || errno == ENOENT))
       error = 0;               /* ignore EINVAL/ENOENT */
     if (error < 0)
index 25b547d90322eca2fbb7d603696e2cca7ba4d2c6..51837cbef3dc71672fa7480e6a595409c4cc0aa0 100644 (file)
@@ -975,7 +975,7 @@ xsnprintf(char *str, size_t size, const char *format, ...)
 #ifdef HAVE_VSNPRINTF
   ret = vsnprintf(str, size, format, ap);
 #else /* not HAVE_VSNPRINTF */
-  ret = sprintf(str, format, ap); /* less secure version */
+  ret = vsprintf(str, format, ap); /* less secure version */
 #endif /* not HAVE_VSNPRINTF */
   va_end(ap);
   return ret;