From 2c865d9aa7b9c3511f901b2544b667c5188f510e Mon Sep 17 00:00:00 2001 From: Qingning Huo Date: Sun, 11 Sep 2005 14:27:47 +0100 Subject: [PATCH 1/9] [PATCH] Fix buffer overflow in ce_flush(). Add a check before appending SHA1 signature to write_buffer, flush it first if necessary. Signed-off-by: Junio C Hamano --- read-cache.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/read-cache.c b/read-cache.c index ced597318..6eff4c840 100644 --- a/read-cache.c +++ b/read-cache.c @@ -462,6 +462,13 @@ static int ce_flush(SHA_CTX *context, int fd) SHA1_Update(context, write_buffer, left); } + /* Flush first if not enough space for SHA1 signature */ + if (left + 20 > WRITE_BUFFER_SIZE) { + if (write(fd, write_buffer, left) != left) + return -1; + left = 0; + } + /* Append the SHA1 signature at the end */ SHA1_Final(write_buffer + left, context); left += 20; From e1ccf53a60657930ae7892387736c8b6a91ec610 Mon Sep 17 00:00:00 2001 From: Yasushi SHOJI Date: Mon, 12 Sep 2005 02:29:10 +0900 Subject: [PATCH 2/9] [PATCH] Escape asciidoc's built-in em-dash replacement AsciiDoc replace '--' with em-dash (—) by default. em-dash looks a lot like a single long dash and it's very confusing when we are talking about command options. Section 21.2.8 'Replacements' of AsciiDoc's User Guide says that a backslash in front of double dash prevent the replacement. This patch does just that. Signed-off-by: Yasushi SHOJI Signed-off-by: Junio C Hamano --- Documentation/cvs-migration.txt | 2 +- Documentation/diffcore.txt | 14 +++++++------- Documentation/hooks.txt | 4 ++-- Documentation/tutorial.txt | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Documentation/cvs-migration.txt b/Documentation/cvs-migration.txt index 6e48bdef9..390a72392 100644 --- a/Documentation/cvs-migration.txt +++ b/Documentation/cvs-migration.txt @@ -186,7 +186,7 @@ you would use git-rev-list and git-diff-tree like this: nitfol(); }' -We have already talked about the "--stdin" form of git-diff-tree +We have already talked about the "\--stdin" form of git-diff-tree command that reads the list of commits and compares each commit with its parents. The git-whatchanged command internally runs the equivalent of the above command, and can be used like this: diff --git a/Documentation/diffcore.txt b/Documentation/diffcore.txt index a0ffe85a2..1908b92f3 100644 --- a/Documentation/diffcore.txt +++ b/Documentation/diffcore.txt @@ -22,8 +22,8 @@ The git-diff-* family works by first comparing two sets of files: - git-diff-index compares contents of a "tree" object and the - working directory (when '--cached' flag is not used) or a - "tree" object and the index file (when '--cached' flag is + working directory (when '\--cached' flag is not used) or a + "tree" object and the index file (when '\--cached' flag is used); - git-diff-files compares contents of the index file and the @@ -164,11 +164,11 @@ similarity score different from the default 50% by giving a number after "-M" or "-C" option (e.g. "-M8" to tell it to use 8/10 = 80%). -Note. When the "-C" option is used with --find-copies-harder +Note. When the "-C" option is used with `\--find-copies-harder` option, git-diff-\* commands feed unmodified filepairs to diffcore mechanism as well as modified ones. This lets the copy detector consider unmodified files as copy source candidates at -the expense of making it slower. Without --find-copies-harder, +the expense of making it slower. Without `\--find-copies-harder`, git-diff-\* commands can detect copies only if the file that was copied happened to have been modified in the same changeset. @@ -220,7 +220,7 @@ diffcore-pickaxe This transformation is used to find filepairs that represent changes that touch a specified string, and is controlled by the --S option and the --pickaxe-all option to the git-diff-* +-S option and the `\--pickaxe-all` option to the git-diff-* commands. When diffcore-pickaxe is in use, it checks if there are @@ -229,9 +229,9 @@ whose "result" side does not. Such a filepair represents "the string appeared in this changeset". It also checks for the opposite case that loses the specified string. -When --pickaxe-all is not in effect, diffcore-pickaxe leaves +When `\--pickaxe-all` is not in effect, diffcore-pickaxe leaves only such filepairs that touches the specified string in its -output. When --pickaxe-all is used, diffcore-pickaxe leaves all +output. When `\--pickaxe-all` is used, diffcore-pickaxe leaves all filepairs intact if there is such a filepair, or makes the output empty otherwise. The latter behaviour is designed to make reviewing of the changes in the context of the whole diff --git a/Documentation/hooks.txt b/Documentation/hooks.txt index ca0efeecc..57f472087 100644 --- a/Documentation/hooks.txt +++ b/Documentation/hooks.txt @@ -57,7 +57,7 @@ pre-commit ---------- This hook is invoked by `git-commit`, and can be bypassed -with `--no-verify` option. It takes no parameter, and is +with `\--no-verify` option. It takes no parameter, and is invoked before obtaining the proposed commit log message and making a commit. Exiting with non-zero status from this script causes the `git-commit` to abort. @@ -70,7 +70,7 @@ commit-msg ---------- This hook is invoked by `git-commit`, and can be bypassed -with `--no-verify` option. It takes a single parameter, the +with `\--no-verify` option. It takes a single parameter, the name of the file that holds the proposed commit log message. Exiting with non-zero status causes the `git-commit` to abort. diff --git a/Documentation/tutorial.txt b/Documentation/tutorial.txt index 6e100dbb6..928a22cd7 100644 --- a/Documentation/tutorial.txt +++ b/Documentation/tutorial.txt @@ -828,7 +828,7 @@ which will very loudly warn you that you're now committing a merge (which is correct, so never mind), and you can write a small merge message about your adventures in git-merge-land. -After you're done, start up `gitk --all` to see graphically what the +After you're done, start up `gitk \--all` to see graphically what the history looks like. Notice that `mybranch` still exists, and you can switch to it, and continue to work with it if you want to. The `mybranch` branch will not contain the merge, but next time you merge it @@ -883,7 +883,7 @@ not actually do a merge. Instead, it just updated the top of the tree of your branch to that of the `master` branch. This is often called 'fast forward' merge. -You can run `gitk --all` again to see how the commit ancestry +You can run `gitk \--all` again to see how the commit ancestry looks like, or run `show-branch`, which tells you this. ------------------------------------------------ From a4c5f9aab740b6d3972c395d4b1af10c2026244b Mon Sep 17 00:00:00 2001 From: "martin@catalyst.net.nz" Date: Sun, 11 Sep 2005 21:26:05 +1200 Subject: [PATCH 3/9] [PATCH] archimport documentation update Updated and expanded the command description, and added a reference of the command line options. Signed-off-by: Martin Langhoff Signed-off-by: Junio C Hamano --- Documentation/git-archimport.txt | 59 ++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/Documentation/git-archimport.txt b/Documentation/git-archimport.txt index 8ce5f0a93..b1348351e 100644 --- a/Documentation/git-archimport.txt +++ b/Documentation/git-archimport.txt @@ -8,24 +8,63 @@ git-archimport - Import an arch repository into git SYNOPSIS -------- -`git-archimport` [--option...] +`git-archimport` [ -h ] [ -v ] [ -T ] [ -t tempdir ] + [ ] DESCRIPTION ----------- -The script expects you to provide the key roots where it can start the -import from an 'initial import' or 'tag' type of Arch commit. It will -then follow all the branching and tagging within the provided roots. +Imports a project from one or more Arch repositories. It will follow branches +and repositories within the namespaces defined by the +parameters suppplied. If it cannot find the remote branch a merge comes from +it will just import it as a regular merge. If it can find it, it will perform +a merge whenever possible. -It will die if it sees branches that have different roots. +The script expects you to provide the key roots where it can start the import +from an 'initial import' or 'tag' type of Arch commit. It will follow and import +new branches within the provided roots. +It expects to be dealing with one project only. If it sees +branches that have different roots, it will refuse to run. In that case, edit your + parameters to define clearly the scope of the import. + +`git-archimport` uses `tla` extensively in the background to access the Arch repository. +Make sure you have a recent version of `tla` available in the path. `tla` must +know about the repositories you pass to `git-archimport`. + +For the initial import `git-archimport` expects to find itself in an empty +directory. To follow the development of a project that uses Arch, rerun +`git-archimport` with the same parameters as the initial import to perform incremental imports. +of a project using Arch. + +Patch merge data from Arch is used to mark merges in GIT as well. GIT +does not care much about tracking patches, and only considers a merge when a +branch incorporates all the commits since the point they forked. The end result +is that GIT will have a good idea of how far branches have diverged. So the +import process does lose some patch-trading metadata. + +Fortunately, when you try and merge branches imported from Arch, +GIT will find a good merge base, and it has a good chance of identifying +patches that have been traded out-of-sequence between the branches. OPTIONS ------- ---option:: - Some option not yet documented. -...:: - Some argument not yet documented. +-h:: + Display usage. + +-v:: + Verbose output. + +-T:: + Many tags. Will create a tag for every commit, reflecting the commit + name in the Arch repository. + +-t :: + Override the default tempdir. + + +:: + Archive/branch identifier in a format that `tla log` understands. Author @@ -34,7 +73,7 @@ Written by Martin Langhoff . Documentation -------------- -Documentation by Junio C Hamano and the git-list . +Documentation by Junio C Hamano, Martin Langhoff and the git-list . GIT --- From a5c500b76cfdc3da0f8cb36dadb5f4ba7ecff401 Mon Sep 17 00:00:00 2001 From: "martin@catalyst.net.nz" Date: Sun, 11 Sep 2005 21:26:05 +1200 Subject: [PATCH 4/9] [PATCH] archimport documentation tidyup New "merges" headline, clarified some parts that were not easy to understand. Signed-off-by: Martin Langhoff Signed-off-by: Junio C Hamano --- Documentation/git-archimport.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Documentation/git-archimport.txt b/Documentation/git-archimport.txt index b1348351e..fa0779b39 100644 --- a/Documentation/git-archimport.txt +++ b/Documentation/git-archimport.txt @@ -3,7 +3,7 @@ git-archimport(1) NAME ---- -git-archimport - Import an arch repository into git +git-archimport - Import an Arch repository into GIT SYNOPSIS @@ -16,8 +16,8 @@ DESCRIPTION Imports a project from one or more Arch repositories. It will follow branches and repositories within the namespaces defined by the parameters suppplied. If it cannot find the remote branch a merge comes from -it will just import it as a regular merge. If it can find it, it will perform -a merge whenever possible. +it will just import it as a regular commit. If it can find it, it will mark it +as a merge whenever possible (see discussion below). The script expects you to provide the key roots where it can start the import from an 'initial import' or 'tag' type of Arch commit. It will follow and import @@ -34,8 +34,9 @@ know about the repositories you pass to `git-archimport`. For the initial import `git-archimport` expects to find itself in an empty directory. To follow the development of a project that uses Arch, rerun `git-archimport` with the same parameters as the initial import to perform incremental imports. -of a project using Arch. +MERGES +------ Patch merge data from Arch is used to mark merges in GIT as well. GIT does not care much about tracking patches, and only considers a merge when a branch incorporates all the commits since the point they forked. The end result From 241b59675fb9f97531b9d76ae949d61da65c1f3d Mon Sep 17 00:00:00 2001 From: "martin@catalyst.net.nz" Date: Sun, 11 Sep 2005 21:26:05 +1200 Subject: [PATCH 5/9] [PATCH] archimport - update in-script doco, options tidyup Updated the usage/help message to match asciidoc documentation. The perldoc documentation now includes the first paragraph from the asciidoc documentation and points users to the manpage. Updated TODO section. Removed some redundant options from the getopt() invocation. Signed-off-by: Martin Langhoff Signed-off-by: Junio C Hamano --- git-archimport.perl | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/git-archimport.perl b/git-archimport.perl index 06d814966..7ae809e44 100755 --- a/git-archimport.perl +++ b/git-archimport.perl @@ -6,23 +6,27 @@ # The basic idea is to walk the output of tla abrowse, # fetch the changesets and apply them. # + =head1 Invocation - git-archimport -i / [/] - [ / ] + git-archimport [ -h ] [ -v ] [ -T ] [ -t tempdir ] / [ / ] - The script expects you to provide the key roots where it can start the - import from an 'initial import' or 'tag' type of Arch commit. It will - then follow all the branching and tagging within the provided roots. +Imports a project from one or more Arch repositories. It will follow branches +and repositories within the namespaces defined by the +parameters suppplied. If it cannot find the remote branch a merge comes from +it will just import it as a regular commit. If it can find it, it will mark it +as a merge whenever possible. - It will die if it sees branches that have different roots. +See man (1) git-archimport for more details. -=head2 TODO +=head1 TODO - - keep track of merged patches, and mark a git merge when it happens - - smarter rules to parse the archive history "up" and "down" - - be able to continue an import where we left off + - create tag objects instead of ref tags - audit shell-escaping of filenames + - better handling of temp directories + - use GIT_DIR instead of hardcoded ".git" + - hide our private tags somewhere smarter + - find a way to make "cat *patches | patch" safe even when patchfiles are missing newlines =head1 Devel tricks @@ -54,14 +58,13 @@ =head1 Devel tricks sub usage() { print STDERR <= 1 or usage(); @@ -71,10 +74,6 @@ END $tmp ||= '/tmp'; $tmp .= '/git-archimport/'; -my $git_tree = $opt_C; -$git_tree ||= "."; - - my @psets = (); # the collection my %psets = (); # the collection, by name From 1d4710d06ccf6911b42a3a7b4a4bf148008f32a5 Mon Sep 17 00:00:00 2001 From: "martin@catalyst.net.nz" Date: Sun, 11 Sep 2005 21:26:05 +1200 Subject: [PATCH 6/9] [PATCH] archimport - use GIT_DIR instead of hardcoded ".git" Use GIT_DIR from the environment instead of a hardcoded '.git' string. Signed-off-by: Martin Langhoff Signed-off-by: Junio C Hamano --- git-archimport.perl | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/git-archimport.perl b/git-archimport.perl index 7ae809e44..518a0ea91 100755 --- a/git-archimport.perl +++ b/git-archimport.perl @@ -24,7 +24,6 @@ =head1 TODO - create tag objects instead of ref tags - audit shell-escaping of filenames - better handling of temp directories - - use GIT_DIR instead of hardcoded ".git" - hide our private tags somewhere smarter - find a way to make "cat *patches | patch" safe even when patchfiles are missing newlines @@ -52,6 +51,9 @@ =head1 Devel tricks $SIG{'PIPE'}="IGNORE"; $ENV{'TZ'}="UTC"; +my $git_dir = $ENV{"GIT_DIR"} || ".git"; +$ENV{"GIT_DIR"} = $git_dir; + our($opt_h,$opt_v, $opt_T, $opt_C,$opt_t); @@ -179,7 +181,7 @@ END ## and put an initial import ## or a full tag my $import = 0; -unless (-d '.git') { # initial import +unless (-d $git_dir) { # initial import if ($psets[0]{type} eq 'i' || $psets[0]{type} eq 't') { print "Starting import from $psets[0]{id}\n"; `git-init-db`; @@ -190,11 +192,11 @@ END } } else { # progressing an import # load the rptags - opendir(DIR, ".git/archimport/tags") + opendir(DIR, "$git_dir/archimport/tags") || die "can't opendir: $!"; while (my $file = readdir(DIR)) { # skip non-interesting-files - next unless -f ".git/archimport/tags/$file"; + next unless -f "$git_dir/archimport/tags/$file"; next if $file =~ m/--base-0$/; # don't care for base-0 my $sha = ptag($file); chomp $sha; @@ -238,7 +240,7 @@ END } unless ($import) { # skip for import - if ( -e ".git/refs/heads/$ps->{branch}") { + if ( -e "$git_dir/refs/heads/$ps->{branch}") { # we know about this branch `git checkout $ps->{branch}`; } else { @@ -291,7 +293,7 @@ END # imports don't give us good info # on added files. Shame on them if ($ps->{type} eq 'i' || $ps->{type} eq 't') { - `find . -type f -print0 | grep -zv '^./.git' | xargs -0 -l100 git-update-index --add`; + `find . -type f -print0 | grep -zv '^./$git_dir' | xargs -0 -l100 git-update-index --add`; `git-ls-files --deleted -z | xargs --no-run-if-empty -0 -l100 git-update-index --remove`; } @@ -355,8 +357,8 @@ END # Who's your daddy? # my @par; - if ( -e ".git/refs/heads/$ps->{branch}") { - if (open HEAD, "<.git/refs/heads/$ps->{branch}") { + if ( -e "$git_dir/refs/heads/$ps->{branch}") { + if (open HEAD, "<$git_dir/refs/heads/$ps->{branch}") { my $p = ; close HEAD; chomp $p; @@ -403,11 +405,11 @@ END # # Update the branch # - open HEAD, ">.git/refs/heads/$ps->{branch}"; + open HEAD, ">$git_dir/refs/heads/$ps->{branch}"; print HEAD $commitid; close HEAD; - unlink ('.git/HEAD'); - symlink("refs/heads/$ps->{branch}",".git/HEAD"); + unlink ("$git_dir/HEAD"); + symlink("refs/heads/$ps->{branch}","$git_dir/HEAD"); # tag accordingly ptag($ps->{id}, $commitid); # private tag @@ -436,7 +438,7 @@ sub apply_import { `tla get -s --no-pristine -A $ps->{repo} $ps->{id} $tmp/import`; die "Cannot get import: $!" if $?; - `rsync -v --archive --delete --exclude '.git' --exclude '.arch-ids' --exclude '{arch}' $tmp/import/* ./`; + `rsync -v --archive --delete --exclude '$git_dir' --exclude '.arch-ids' --exclude '{arch}' $tmp/import/* ./`; die "Cannot rsync import:$!" if $?; `rm -fr $tmp/import`; @@ -482,7 +484,7 @@ sub apply_cset { } # bring in new files - `rsync --archive --exclude '.git' --exclude '.arch-ids' --exclude '{arch}' $tmp/changeset/new-files-archive/* ./`; + `rsync --archive --exclude '$git_dir' --exclude '.arch-ids' --exclude '{arch}' $tmp/changeset/new-files-archive/* ./`; # deleted files are hinted from the commitlog processing @@ -577,7 +579,7 @@ sub tag { $tag = shell_quote($tag); if ($commit) { - open(C,">.git/refs/tags/$tag") + open(C,">$git_dir/refs/tags/$tag") or die "Cannot create tag $tag: $!\n"; print C "$commit\n" or die "Cannot write tag $tag: $!\n"; @@ -585,7 +587,7 @@ sub tag { or die "Cannot write tag $tag: $!\n"; print " * Created tag ' $tag' on '$commit'\n" if $opt_v; } else { # read - open(C,"<.git/refs/tags/$tag") + open(C,"<$git_dir/refs/tags/$tag") or die "Cannot read tag $tag: $!\n"; $commit = ; chomp $commit; @@ -603,12 +605,12 @@ sub ptag { $tag =~ s|/|--|g; $tag = shell_quote($tag); - unless (-d '.git/archimport/tags') { - mkpath('.git/archimport/tags'); + unless (-d "$git_dir/archimport/tags") { + mkpath("$git_dir/archimport/tags"); } if ($commit) { # write - open(C,">.git/archimport/tags/$tag") + open(C,">$git_dir/archimport/tags/$tag") or die "Cannot create tag $tag: $!\n"; print C "$commit\n" or die "Cannot write tag $tag: $!\n"; @@ -618,10 +620,10 @@ sub ptag { unless $tag =~ m/--base-0$/; } else { # read # if the tag isn't there, return 0 - unless ( -s ".git/archimport/tags/$tag") { + unless ( -s "$git_dir/archimport/tags/$tag") { return 0; } - open(C,"<.git/archimport/tags/$tag") + open(C,"<$git_dir/archimport/tags/$tag") or die "Cannot read tag $tag: $!\n"; $commit = ; chomp $commit; From 127bf00f7d2fee044602bec8c76ec9d6bf368025 Mon Sep 17 00:00:00 2001 From: "martin@catalyst.net.nz" Date: Sun, 11 Sep 2005 21:26:05 +1200 Subject: [PATCH 7/9] [PATCH] archimport - better handling of temp dirs Switched from backwards hard-coded tmp directory creation to using File::Temp::tempdir() to create the directory inside $TMP_PATH or what the user has provided via the -t parameter. Signed-off-by: Martin Langhoff Signed-off-by: Junio C Hamano --- git-archimport.perl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/git-archimport.perl b/git-archimport.perl index 518a0ea91..3749b8b57 100755 --- a/git-archimport.perl +++ b/git-archimport.perl @@ -23,7 +23,6 @@ =head1 TODO - create tag objects instead of ref tags - audit shell-escaping of filenames - - better handling of temp directories - hide our private tags somewhere smarter - find a way to make "cat *patches | patch" safe even when patchfiles are missing newlines @@ -37,7 +36,7 @@ =head1 Devel tricks use warnings; use Getopt::Std; use File::Spec; -use File::Temp qw(tempfile); +use File::Temp qw(tempfile tempdir); use File::Path qw(mkpath); use File::Basename qw(basename dirname); use String::ShellQuote; @@ -72,9 +71,10 @@ END @ARGV >= 1 or usage(); my @arch_roots = @ARGV; -my $tmp = $opt_t; -$tmp ||= '/tmp'; -$tmp .= '/git-archimport/'; +my ($tmpdir, $tmpdirname) = tempdir('git-archimport-XXXXXX', TMPDIR => 1, CLEANUP => 1); +my $tmp = $opt_t || 1; +$tmp = tempdir('git-archimport-XXXXXX', TMPDIR => 1, CLEANUP => 1); +$opt_v && print "+ Using $tmp as temporary directory\n"; my @psets = (); # the collection my %psets = (); # the collection, by name From 65a9289d7e5207ed66199db94593b31fa5550fde Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Mon, 12 Sep 2005 11:03:43 +1000 Subject: [PATCH 8/9] [PATCH] Apply N -> A status change in diff-helper When the git diff status 'N' was changed to 'A', diff-helper.c was not updated accordingly. This means that it no longer shows the diff for newly added files. This patch makes that change in diff-helper.c. Signed-off-by: Herbert Xu Signed-off-by: Junio C Hamano --- diff-helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diff-helper.c b/diff-helper.c index 3fa50ee75..734956e4d 100644 --- a/diff-helper.c +++ b/diff-helper.c @@ -91,7 +91,7 @@ int main(int ac, const char **av) { if (*cp++ != ' ') break; status = *cp++; - if (!strchr("MCRNDU", status)) + if (!strchr("AMCRDU", status)) break; two_paths = score = 0; if (status == DIFF_STATUS_RENAMED || From 7fa090844f7d1624c7d1ffc621aae6aec84a1110 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 11 Sep 2005 13:58:41 -0700 Subject: [PATCH 9/9] Use int instead of socklen_t This should work around the compilation problem Johannes Schindelin and others had on Mac OS/X. Quoting Linus: Any operating system where socklen_t is anything else than "int" is terminally broken. The people who introduced that typedef were confused, and I actually had to argue with them that it was fundamentally wrong: there is no other valid type than "int" that makes sense for it. Signed-off-by: Junio C Hamano --- daemon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/daemon.c b/daemon.c index 24bac1666..5100cf2f4 100644 --- a/daemon.c +++ b/daemon.c @@ -80,11 +80,11 @@ static unsigned int children_deleted = 0; static struct child { pid_t pid; - socklen_t addrlen; + int addrlen; struct sockaddr_storage address; } live_child[MAX_CHILDREN]; -static void add_child(int idx, pid_t pid, struct sockaddr *addr, socklen_t addrlen) +static void add_child(int idx, pid_t pid, struct sockaddr *addr, int addrlen) { live_child[idx].pid = pid; live_child[idx].addrlen = addrlen; @@ -178,7 +178,7 @@ static void check_max_connections(void) } } -static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen) +static void handle(int incoming, struct sockaddr *addr, int addrlen) { pid_t pid = fork(); @@ -308,7 +308,7 @@ static int serve(int port) if (FD_ISSET(sockfd, &fds)) { struct sockaddr_storage ss; - socklen_t sslen = sizeof(ss); + int sslen = sizeof(ss); int incoming = accept(sockfd, (struct sockaddr *)&ss, &sslen); if (incoming < 0) { switch (errno) {