- Timestamp:
- Jan 29, 2007, 9:40:44 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_unix.c
r86 r89 4323 4323 4324 4324 4325 int hideout_hex_block(SL_TICKET fd, unsigned char * str, int len); 4325 int hideout_hex_block(SL_TICKET fd, unsigned char * str, int len, 4326 unsigned long * bytes_read); 4326 4327 unsigned long first_hex_block(SL_TICKET fd, unsigned long * max); 4327 4328 … … 4331 4332 int sh_unix_getline_stealth (SL_TICKET fd, char * str, int len) 4332 4333 { 4333 int add_off, llen; 4334 static unsigned long off_data = 0; 4335 static unsigned long max_data = 0; 4334 int add_off = 0, llen; 4335 static unsigned long off_data = 0; 4336 static unsigned long max_data = 0; 4337 static unsigned long bytes_read = 0; 4336 4338 static int stealth_init = BAD; 4337 4339 … … 4358 4360 /* --- Seek to proper position. --- 4359 4361 */ 4360 if ( off_data >= max_data)4362 if (bytes_read >= max_data || add_off < 0) 4361 4363 { 4362 4364 dlog(1, FIL__, __LINE__, … … 4370 4372 /* --- Read one line. --- 4371 4373 */ 4372 add_off = hideout_hex_block(fd, (unsigned char *) str, len );4374 add_off = hideout_hex_block(fd, (unsigned char *) str, len, &bytes_read); 4373 4375 off_data += add_off; 4374 4376 … … 4377 4379 } 4378 4380 4379 int hideout_hex_block(SL_TICKET fd, unsigned char * str, int len) 4381 int hideout_hex_block(SL_TICKET fd, unsigned char * str, int len, 4382 unsigned long * bytes_read) 4380 4383 { 4381 4384 … … 4386 4389 unsigned long here = 0; 4387 4390 unsigned long retval = 0; 4391 unsigned long bread = 0; 4388 4392 4389 4393 SL_ENTER(_("hideout_hex_block")); … … 4410 4414 num = sl_read (fd, &c, 1); 4411 4415 } while (num == 0 && errno == EINTR); 4412 if (num == 0) 4416 if (num > 0) 4417 ++here; 4418 else if (num == 0) 4413 4419 SL_RETURN((0), _("hideout_hex_block")); 4414 ++here; 4420 else 4421 SL_RETURN((-1), _("hideout_hex_block")); 4415 4422 } while (c == '\n' || c == '\t' || c == '\r' || 4416 4423 c == ' '); … … 4426 4433 str[i] &= ~mask[j]; 4427 4434 4435 bread += 1; 4428 4436 } 4429 4437 if (str[i] == '\n') break; … … 4436 4444 str[i+1] = '\0'; /* keep newline and terminate */ 4437 4445 retval += here; 4446 *bytes_read += (bread/8); 4438 4447 4439 4448 SL_RETURN(retval, _("hideout_hex_block"));
Note:
See TracChangeset
for help on using the changeset viewer.