search for: read_line

Displaying 20 results from an estimated 95 matches for "read_line".

Did you mean: read_lines
2015 Oct 09
1
[PATCH] inspect: Don't free uninitialized string.
libguestfs: trace: v2v: read_lines "/etc/os-release" [...] libguestfs: trace: v2v: read_lines = ["NAME=Fedora", "VERSION="20 (Heisenbug)"", "ID=fedora", "VERSION_ID=20", "PRETTY_NAME="Fedora 20 (Heisenbug)"", "ANSI_COLOR="0;34"", &qu...
2012 Apr 18
1
[PATCH RFC] sysprep: remove user accounts
...fth Floor, Boston, MA 02110-1301 USA. + *) + +open Sysprep_operation + +module G = Guestfs + +let user_account_perform g root = + let typ = g#inspect_get_type root in + if typ <> "windows" then ( + let login_def = "/etc/login.defs" in + let lines = Array.to_list (g#read_lines login_def) in + let line_min = Array.filter ( + fun line -> (string_prefix line "UID_MIN") + ) lines in + let _,min_uid = sscanf line_min "%s %d" (fun a b -> a,b) in + let line_max = Array.filter ( + fun line -> (string_prefix line "UID_MAX&q...
2012 Sep 19
1
[PATCH 1/1] lua: Enabling io.read() in Lua.c32 with some restrictions
...9,9 @@ static int read_number (lua_State *L, FILE *f) { return 0; /* read fails */ } } +#endif - +#ifndef NO_TEST_EOF /* no buffering -> no ungetc() -> no EOF test */ static int test_eof (lua_State *L, FILE *f) { int c = getc(f); ungetc(c, f); @@ -315,7 +322,6 @@ static int read_line (lua_State *L, FILE *f) { } } -#ifndef SYSLINUX /* Not used */ static int read_chars (lua_State *L, FILE *f, size_t n) { size_t rlen; /* how much to read */ size_t nr; /* number of chars actually read */ @@ -337,7 +343,9 @@ static int g_read (lua_State *L, FILE *...
2002 Apr 03
4
Patch to avoid 'Connection reset by peer' error for rsync on cygwin
...is anyway to alert people to the problem and its fix. Max. BEGIN PATCH diff -mru rsync-2.5.5/clientserver.c rsync-2.5.5-tweaked/clientserver.c --- rsync-2.5.5/clientserver.c Wed Mar 27 01:03:13 2002 +++ rsync-2.5.5-tweaked/clientserver.c Wed Apr 3 11:01:57 2002 @@ -486,39 +486,44 @@ } if (!read_line(fd, line, sizeof(line)-1)) { - return -1; + goto exitwithnomodule; } if (sscanf(line,"@RSYNCD: %d", &remote_version) != 1) { io_printf(fd,"@ERROR: protocol startup error\n"); - return -1; + goto exitwithnomodule; } while (i == -1) { line[0] = 0; if (!r...
2001 Nov 20
2
rsync server over SSH [includes code patches]
...r *auth_server(int f_in, int f_out, int module, char *addr, char *leader) { char *users = lp_auth_users(module); char challenge[16]; *************** *** 221,229 **** base64_encode(challenge, 16, b64_challenge); ! io_printf(fd,"%s%s\n", leader, b64_challenge); ! if (!read_line(fd, line, sizeof(line)-1)) { return NULL; } --- 221,229 ---- base64_encode(challenge, 16, b64_challenge); ! io_printf(f_out,"%s%s\n", leader, b64_challenge); ! if (!read_line(f_in, line, sizeof(line)-1)) { return NULL; } Index: clientserver.c ===========...
2002 May 09
0
[PATCH] (Resubmission) 'Connection reset by peer' with rsync server on cygwin
...t needs time, or me to go and fix something??? Thanks Max. BEGIN PATCH diff -mru rsync-2.5.5/clientserver.c rsync-2.5.5-tweaked/clientserver.c --- rsync-2.5.5/clientserver.c Wed Mar 27 01:03:13 2002 +++ rsync-2.5.5-tweaked/clientserver.c Wed Apr 3 11:01:57 2002 @@ -486,39 +486,44 @@ } if (!read_line(fd, line, sizeof(line)-1)) { - return -1; + goto exitwithnomodule; } if (sscanf(line,"@RSYNCD: %d", &remote_version) != 1) { io_printf(fd,"@ERROR: protocol startup error\n"); - return -1; + goto exitwithnomodule; } while (i == -1) { line[0] = 0; if (!r...
2001 Aug 22
1
@RSYNC EXIT / @RSYNC EOF
...{ extern int list_only; list_only = 1; @@ -107,6 +108,10 @@ int start_socket_client(char *host, char if (p) *p = '/'; while (1) { + /* Old servers may just drop the connection here, + rather than sending a proper EXIT command. Yuck. */ + kludge_around_eof= True; + if (!read_line(fd, line, sizeof(line)-1)) { return -1; } @@ -122,6 +127,7 @@ int start_socket_client(char *host, char rprintf(FINFO,"%s\n", line); } + kludge_around_eof = False; for (i=0;i<sargc;i++) { io_printf(fd,"%s\n", sargs[i]); Index: io.c ========================...
2014 Feb 13
2
Re: [PATCH] mllib: hostname: replace the hostname on Debian also in /etc/hosts (RHBZ#953907).
On Thursday 13 February 2014 13:33:16 Richard W.M. Jones wrote: > On Thu, Feb 13, 2014 at 02:15:31PM +0100, Pino Toscano wrote: > > + let expr = "/files/etc/hosts/*[label() != '#comment']/*[label() > > != 'ipaddr'][. = '" ^ oldhost ^ "']" in > Quoting? If oldhost contains a ' character + some Augeas code, this > might be
2014 Feb 12
2
[PATCH 1/2] mllib: hostname: replace the hostname on Debian also in /etc/hosts (RHBZ#953907).
...ostname g hostname = and update_etc_machine_info g hostname = replace_line_in_file g "/etc/machine-info" "PRETTY_HOSTNAME" hostname + +and read_etc_hostname g = + let filename = "/etc/hostname" in + if g#is_file filename then ( + let lines = Array.to_list (g#read_lines filename) in + match lines with + | hd :: _ -> Some hd + | [] -> None + ) else + None + +and replace_host_in_etc_hosts g oldhost newhost = + let filename = "/etc/hosts" in + if g#is_file filename then ( + Perl_edit.edit_file ~debug:false g filename + ("s...
2002 Jan 13
0
rsynd-2.5.1 / io.c patches
...nnection */ -static void write_sbuf(int f,char *buf) +static void write_sbuf(int f,const char *buf) { write_buf(f, buf, strlen(buf)); } @@ -601,13 +616,15 @@ void write_byte(int f,unsigned char c) { - write_buf(f,(char *)&c,1); + write_buf(f, &c,1); } -int read_line(int f, char *buf, int maxlen) +int read_line(int f, void *buf1, int maxlen) { +unsigned char * buf; + buf = (unsigned char *)buf1; while (maxlen) { buf[0] = 0; read_buf(f, buf, 1); @@ -664,7 +681,7 @@ } /* write an message to the multiplexed e...
2012 Sep 03
2
[PATCH] sysprep: remove hostname from ifcfg-*
..."|"centos"|"scientificlinux"|"redhat-based") -> + let filenames = g#glob_expand "/etc/sysconfig/network-scripts/ifcfg-*" in + Array.iter ( + fun filename -> + (* Replace HOSTNAME=... entry. *) + let lines = Array.to_list (g#read_lines filename) in + let lines = List.filter ( + fun line -> not (string_prefix line "HOSTNAME=") + ) lines in + let file = String.concat "\n" lines ^ "\n" in + g#write filename file + ) filenames; + + if filenames <> [||]...
2017 Dec 14
4
cannot destroy connection (?) created by readLines in a tryCatch
..., that's often a possible workaround, but since this connection was opened by readLines() internally, I don't necessarily know which one it is. E.g. I might open multiple connections to the same file, so I can't choose based on the file name. Btw. this workaround seems to work for me: read_lines <- function(con, ...) { if (is.character(con)) { con <- file(con) on.exit(close(con)) } readLines(con, ...) } This is basically the same as readLines(), but on.exit() does its job here. That's another clue that it might be an on.exit() issue. Wild guess: on.exit() does not...
2017 Jan 03
0
[PATCH 5/5] Add a virt-builder-repository tool
...ize" infos in + + let xz_path = compress_to filepath cmdline.repo in + let checksum = Checksums.get_checksum (Checksums.SHA512 "") xz_path in + let compressed_size = (Unix.stat xz_path).Unix.st_size in + + let ask message = ( + printf (f_ message); + let value = read_line () in + match value with + | "" -> None + | s -> Some s + ) in + + let rec ask_id () = ( + printf (f_"Identifier: "); + let id = read_line () in + if not (Str.string_match (Str.regexp "[a-zA-Z0-9-_.]+") id 0) then ( + pr...
2006 Mar 20
1
RJS & IE Woes
..._data'' c:/ruby/lib/ruby/1.8/webrick/httprequest.rb:324:in `timeout'' c:/ruby/lib/ruby/1.8/timeout.rb:55:in `timeout'' c:/ruby/lib/ruby/1.8/webrick/httprequest.rb:324:in `_read_data'' c:/ruby/lib/ruby/1.8/webrick/httprequest.rb:335:in `read_line'' c:/ruby/lib/ruby/1.8/webrick/httprequest.rb:225:in `read_request_line'' c:/ruby/lib/ruby/1.8/webrick/httprequest.rb:86:in `parse'' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:56:in `run'' c:/ruby/lib/ruby/1.8/webrick/server.rb:155:in...
2017 Mar 07
0
[PATCH v4 9/9] Add a virt-builder-repository tool
...rmat; size = size } = get_disk_image_info filepath in + let xz_path = compress_to filepath tmprepo in + let checksum = Checksums.compute_checksum "sha512" xz_path in + let compressed_size = (Unix.stat xz_path).Unix.st_size in + + let ask message = + printf message; + let value = read_line () in + match value with + | "" -> None + | s -> Some s + in + + let rec ask_id () = + printf (f_"Identifier: "); + let id = read_line () in + if not (Str.string_match (Str.regexp "[a-zA-Z0-9-_.]+") id 0) then ( + warning (f_"Allowed...
2017 Mar 23
0
[PATCH v5 10/10] Add a virt-builder-repository tool
...= get_disk_image_info filepath in + let xz_path = compress_to filepath tmprepo in + let checksum = Checksums.compute_checksum "sha512" xz_path in + let compressed_size = (Unix.LargeFile.stat xz_path).Unix.LargeFile.st_size in + + let ask message = + printf message; + let value = read_line () in + match value with + | "" -> None + | s -> Some s + in + + let rec ask_id () = + printf (f_"Identifier: "); + let id = read_line () in + if not (Str.string_match (Str.regexp "[a-zA-Z0-9-_.]+") id 0) then ( + warning (f_"Allowed...
2017 Feb 10
0
[PATCH v3 10/10] Add a virt-builder-repository tool
...t; size = size } = get_disk_image_infos filepath in + let xz_path = compress_to filepath tmprepo in + let checksum = Checksums.compute_checksum "sha512" xz_path in + let compressed_size = (Unix.stat xz_path).Unix.st_size in + + let ask message = ( + printf message; + let value = read_line () in + match value with + | "" -> None + | s -> Some s + ) in + + let rec ask_id () = ( + printf (f_"Identifier: "); + let id = read_line () in + if not (Str.string_match (Str.regexp "[a-zA-Z0-9-_.]+") id 0) then ( + warning (f_"All...
2002 Feb 18
1
fixes for bugs in error handling in rsync-2.5.2; and updates for rsync3.txt
...kludge_around_eof; extern char *bind_address; extern int default_af_hint; *************** *** 113,119 **** /* Old servers may just drop the connection here, rather than sending a proper EXIT command. Yuck. */ ! kludge_around_eof = remote_version < 25; while (1) { if (!read_line(fd, line, sizeof(line)-1)) { --- 114,120 ---- /* Old servers may just drop the connection here, rather than sending a proper EXIT command. Yuck. */ ! kludge_around_eof = list_only && (remote_version < 25); while (1) { if (!read_line(fd, line, sizeof(line)-1)) { Inde...
2017 Feb 28
1
[PATCH] sysprep: Remove DHCP_HOSTNAME= from ifcfg-* files (RHBZ#1427529).
...root side_effects = let filenames = g#glob_expand "/etc/sysconfig/network-scripts/ifcfg-*" in Array.iter ( fun filename -> - (* Replace HOSTNAME=... entry. *) + (* Remove HOSTNAME=... and DHCP_HOSTNAME=... entries. *) let lines = Array.to_list (g#read_lines filename) in let lines = List.filter ( - fun line -> not (String.is_prefix line "HOSTNAME=") + fun line -> + not (String.is_prefix line "HOSTNAME=") && + not (String.is_prefix line "DHCP_HOSTNAME=")...
2006 Feb 22
0
Can you make an HTTP request inside an Ajax action?
...critical session /usr/local/lib/ruby/1.8/timeout.rb:49:in `timeout'' /usr/local/lib/ruby/1.8/timeout.rb:76:in `timeout'' /usr/local/lib/ruby/1.8/webrick/httprequest.rb:329:in `_read_data'' /usr/local/lib/ruby/1.8/webrick/httprequest.rb:340:in `read_line'' /usr/local/lib/ruby/1.8/webrick/httprequest.rb:240:in `read_header'' /usr/local/lib/ruby/1.8/webrick/httprequest.rb:88:in `parse'' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:56:in `run'' /usr/local/lib/ruby/1.8/webrick/server.rb:1...