[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] Miscellaneous mintlib fixes



Attached is a small set of generic fixes.

I'll send out a few more specific ones in a few minutes.

Alan.
Index: crypt/des_impl.c
===================================================================
RCS file: /mint/mintlib/crypt/des_impl.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 des_impl.c
--- crypt/des_impl.c	12 Oct 2000 10:56:27 -0000	1.1.1.1
+++ crypt/des_impl.c	22 Feb 2008 09:16:29 -0000
@@ -578,7 +578,7 @@
   out = (unsigned char *) buf;
   oiv = iv = (unsigned char *) desp->des_ivec;
 
-  des_set_key (desp->des_key, schedule);
+  des_set_key ((char*)desp->des_key, schedule);
 
   tin0 = tin1 = 0;		/* For GCC */
   if (desp->des_dir == ENCRYPT)
Index: dirent/opendir.c
===================================================================
RCS file: /mint/mintlib/dirent/opendir.c,v
retrieving revision 1.3
diff -u -r1.3 opendir.c
--- dirent/opendir.c	8 Oct 2003 15:23:14 -0000	1.3
+++ dirent/opendir.c	22 Feb 2008 09:16:29 -0000
@@ -41,7 +41,7 @@
 	d = malloc(sizeof(DIR));
 	if (!d) {
 		__set_errno (ENOMEM);
-		return d;
+		return NULL;
 	}
 
 	if (!__libc_unix_names)
@@ -55,9 +55,9 @@
 		if ( (r & 0xff000000L) == 0xff000000L ) {
 			if ((r == -ENOTDIR) && (_enoent(name)))
 				r = -ENOENT;
-			__set_errno (-r);
 			free(d);
-			return 0;
+			__set_errno (-r);
+			return NULL;
 		}
 		else {
 			d->handle = r;
Index: dirent/readdir.c
===================================================================
RCS file: /mint/mintlib/dirent/readdir.c,v
retrieving revision 1.3
diff -u -r1.3 readdir.c
--- dirent/readdir.c	8 Oct 2003 15:23:14 -0000	1.3
+++ dirent/readdir.c	22 Feb 2008 09:16:29 -0000
@@ -19,7 +19,7 @@
 
 
 /* Important note: under Metados, some file systems can have opendir/readdir/
- * closdir, so we must not have a status variable for these ones.
+ * closedir, so we must not have a status variable for these ones.
  * Instead, check the directory struct if there was an opendir call.
  */
 
@@ -45,7 +45,7 @@
 	}
 	
 	if (d->handle != 0xff000000L)  {
-		/* The directory descriptor was optained by calling Dopendir(), as
+		/* The directory descriptor was obtained by calling Dopendir(), as
 		 * there is a valid handle.
 		 */
 		r = (int)Dreaddir((int)(NAME_MAX+1+sizeof(long)), d->handle, (char *) &dbuf);
Index: socket/gethostnamadr.c
===================================================================
RCS file: /mint/mintlib/socket/gethostnamadr.c,v
retrieving revision 1.3
diff -u -r1.3 gethostnamadr.c
--- socket/gethostnamadr.c	27 Sep 2001 16:31:37 -0000	1.3
+++ socket/gethostnamadr.c	22 Feb 2008 09:16:32 -0000
@@ -741,7 +741,7 @@
 				      ((unsigned)addr[2] & 0xff),
 				      ((unsigned)addr[1] & 0xff),
 				      ((unsigned)addr[0] & 0xff));
-			n = res_query(qbuf, C_IN, T_PTR, (char *)&buf,
+			n = res_query(qbuf, C_IN, T_PTR, (u_char *)&buf,
 				      sizeof(buf));
 			if (n < 0) {
 #ifdef DEBUG
Index: unix/chdir.c
===================================================================
RCS file: /mint/mintlib/unix/chdir.c,v
retrieving revision 1.7
diff -u -r1.7 chdir.c
--- unix/chdir.c	25 May 2004 22:34:35 -0000	1.7
+++ unix/chdir.c	22 Feb 2008 09:16:32 -0000
@@ -79,8 +79,10 @@
 		if ((r == -ENOTDIR) && _enoent(dir))
 			r = -ENOENT;
 
+		if (tmp)
+			free (tmp);
 		__set_errno (-r);
-		r = -1;
+		return -1;
 	}
 
 	if (tmp)