[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Mtools] Patches from NetBSD pkgsrc
From: |
Sergey Svishchev |
Subject: |
[Mtools] Patches from NetBSD pkgsrc |
Date: |
Wed, 2 May 2007 03:21:04 +0400 |
User-agent: |
Mutt/1.5.14cvs (2007-02-28) |
Good day,
I am forwarding assorted patches that are included into mtools package
in NetBSD (and other operating systems that use pkgsrc framework). They
apply cleanly to 3.9.10.
Enhance "floppyd" to get UID of "nobody" from the password database.
--- floppyd.c.orig 2002-11-02 10:55:24.000000000 +0000
+++ floppyd.c
@@ -583,7 +583,7 @@ static uid_t getuserid(char *user)
}
else
{
- uid = 65535;
+ uid = getuserid("nobody");
}
#if DEBUG
@@ -609,7 +609,7 @@ static uid_t getgroupid(uid_t uid)
}
else
{
- gid = 65535;
+ gid = getgroupid(uid);
}
#if DEBUG
Autoconfiguration process defines OS_netbsdelf on all current NetBSD
platforms (NetBSD PR 21530).
--- devices.c.orig 2003-05-24 20:54:27.000000000 +0000
+++ devices.c
@@ -807,7 +807,7 @@ struct device devices[] = {
#endif /* __FreeBSD__ */
/*** /jes -- for ALR 486 DX4/100 ***/
-#if defined(OS_netbsd)
+#if defined(OS_netbsd) || defined(OS_netbsdelf)
#define predefined_devices
struct device devices[] = {
{"/dev/rfd0a", 'A', FHD312},
Set effective gid so that privileges can be regained later (NetBSD PR 18771)
--- privileges.c.orig 2003-12-11 18:07:44.000000000 +0000
+++ privileges.c
@@ -68,7 +68,7 @@ void reclaim_privs(void)
{
if(noPrivileges)
return;
- setgid(egid);
+ setegid(egid);
Setuid(euid);
print_privs("after reclaim privs, both uids should be 0 ");
}
@@ -76,7 +76,7 @@ void reclaim_privs(void)
void drop_privs(void)
{
Setuid(ruid);
- setgid(rgid);
+ setegid(rgid);
print_privs("after drop_privs, real should be 0, effective should not
");
}
Use thread-safe errno definition provided in system headers.
Fix problem with sector sizes > 1024 bytes.
--- init.c.orig 2002-05-01 09:57:02.000000000 +0000
+++ init.c
@@ -14,9 +14,6 @@
#include "xdf_io.h"
#include "buffer.h"
-extern int errno;
-
-
#define FULL_CYL
unsigned int num_clus; /* total number of cluster */
@@ -27,15 +24,30 @@ unsigned int num_clus; /* total number
*/
static int read_boot(Stream_t *Stream, struct bootsector * boot, int size)
{
+ int rc;
+ char *buf;
+
+ buf = (char *)boot;
+
/* read the first sector, or part of it */
if(!size)
size = BOOTSIZE;
- if(size > 1024)
- size = 1024;
- if (force_read(Stream, (char *) boot, 0, size) != size)
- return -1;
- return 0;
+ if (size > sizeof(struct bootsector)) {
+ buf = malloc(size);
+ if (!buf)
+ return(-1);
+ }
+
+ rc = 0;
+ if (force_read(Stream, buf, 0, size) != size)
+ rc = -1;
+
+ if (buf != (char *)boot) {
+ memcpy(boot, buf, sizeof(struct bootsector));
+ free(buf);
+ }
+ return rc;
}
static int fs_flush(Stream_t *Stream)
Same as above.
--- sysincludes.h.orig 2006-03-25 18:06:25.000000000 +0000
+++ sysincludes.h
@@ -221,7 +221,6 @@ extern int ioctl(int fildes, int request
#include <sys/stat.h>
#include <errno.h>
-extern int errno;
#include <pwd.h>
--- mformat.c.orig 2006-03-25 18:10:18.000000000 +0000
+++ mformat.c
@@ -37,8 +37,6 @@
#endif
-extern int errno;
-
static int init_geometry_boot(struct bootsector *boot, struct device *dev,
int sectors0, int rate_0, int rate_any,
unsigned long *tot_sectors, int keepBoot)
Fix fencepost error when the filename length is N*13 characters (NetBSD
PR 25439).
--- vfat.c.orig 2005-02-13 15:40:17.000000000 +0100
+++ vfat.c
@@ -238,7 +238,7 @@ int write_vfat(Stream_t *Dir, char *shor
printf("Wrote checksum=%d for shortname %s.\n",
vse->sum,shortname);
#endif
- num_vses = strlen(longname)/VSE_NAMELEN + 1;
+ num_vses = (strlen(longname) + VSE_NAMELEN - 1)/VSE_NAMELEN;
for (vse_id = num_vses; vse_id; --vse_id) {
int end = 0;
--- mk_direntry.c.orig 2005-02-28 00:17:45.000000000 +0100
+++ mk_direntry.c
@@ -227,7 +227,8 @@ static void clear_scan(char *longname, i
s->free_end = s->got_slots = s->free_start = 0;
if (use_longname & 1)
- s->size_needed = 2 + (strlen(longname)/VSE_NAMELEN);
+ s->size_needed = 1 +
+ (strlen(longname) + VSE_NAMELEN - 1)/VSE_NAMELEN;
else
s->size_needed = 1;
}
--
Sergey Svishchev
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Mtools] Patches from NetBSD pkgsrc,
Sergey Svishchev <=