bug-grub
[Top][All Lists]
Advanced

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

Re: grub-diskless-patch-3


From: Tobias Wollgam
Subject: Re: grub-diskless-patch-3
Date: Fri, 19 Mar 2004 15:16:31 +0100
User-agent: KMail/1.6

Here is a small patch for tftp server that doesn't support leading 
slashes like sinix or sunos.


diff -Naur grub/netboot/fsys_tftp.c grub-0.94/netboot/fsys_tftp.c
--- grub/netboot/fsys_tftp.c    2004-03-17 13:03:07.000000000 +0100
+++ grub-0.94/netboot/fsys_tftp.c       2004-03-16 17:00:03.000000000 +0100
@@ -572,7 +572,7 @@
 int
 tftp_dir (char *dirname)
 {
-  int ch;
+  int ch,offset = 0;
 
 #ifdef TFTP_DEBUG
   grub_printf ("tftp_dir (%s)\n", dirname);
@@ -582,6 +582,10 @@
   if (print_possibilities)
     return 1;
 
+  /* twollgam: Some tftp server don't want a leading slash */
+  if(dirname[0] == '/') 
+    offset = 1;
+    
   /* Don't know the size yet.  */
   filemax = -1;
   
@@ -593,10 +597,10 @@
   /* Make the request string (octet, blksize and tsize).  */
   len = (grub_sprintf ((char *) tp.u.rrq,
                       "%s%coctet%cblksize%c%d%ctsize%c0",
-                      dirname, 0, 0, 0, TFTP_MAX_PACKET, 0, 0)
+                      dirname + offset, 0, 0, 0, TFTP_MAX_PACKET, 0, 0)
         + sizeof (tp.ip) + sizeof (tp.udp) + sizeof (tp.opcode) + 1);
   /* Restore the original DIRNAME.  */
-  dirname[grub_strlen (dirname)] = ch;
+   dirname[grub_strlen (dirname)] = ch;
   /* Save the TFTP packet so that we can reopen the file later.  */
   grub_memmove ((char *) &saved_tp, (char *) &tp, len);
   saved_len = len;

-- 
Tobias Wollgam
Softwaredevelopment
Competence Center System Management
Business Unit Information 
_________________________________________________
MATERNA GmbH Information & Communications
Vosskuhle 37 * 44141 Dortmund  
http://www.materna.de 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]