~statik/ubuntu/maverick/erlang/erlang-merge-testing

« back to all changes in this revision

Viewing changes to lib/stdlib/src/erl_tar.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-05-01 10:14:38 UTC
  • mfrom: (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090501101438-6qlr6rsdxgyzrg2z
Tags: 1:13.b-dfsg-2
* Cleaned up patches: removed unneeded patch which helped to support
  different SCTP library versions, made sure that changes for m68k
  architecture applied only when building on this architecture.
* Removed duplicated information from binary packages descriptions.
* Don't require libsctp-dev build-dependency on solaris-i386 architecture
  which allows to build Erlang on Nexenta (thanks to Tim Spriggs for
  the suggestion).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%% ``The contents of this file are subject to the Erlang Public License,
 
1
%%
 
2
%% %CopyrightBegin%
 
3
%% 
 
4
%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
 
5
%% 
 
6
%% The contents of this file are subject to the Erlang Public License,
2
7
%% Version 1.1, (the "License"); you may not use this file except in
3
8
%% compliance with the License. You should have received a copy of the
4
9
%% Erlang Public License along with this software. If not, it can be
5
 
%% retrieved via the world wide web at http://www.erlang.org/.
 
10
%% retrieved online at http://www.erlang.org/.
6
11
%% 
7
12
%% Software distributed under the License is distributed on an "AS IS"
8
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
9
14
%% the License for the specific language governing rights and limitations
10
15
%% under the License.
11
16
%% 
12
 
%% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
13
 
%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
14
 
%% AB. All Rights Reserved.''
15
 
%% 
16
 
%%     $Id$
 
17
%% %CopyrightEnd%
17
18
%%
18
19
-module(erl_tar).
19
20
 
65
66
%% Closes a tar archive.
66
67
 
67
68
close({read, File}) ->
68
 
    file:close(File),
69
 
    ok;
 
69
    ok = file:close(File);
70
70
close({write, File}) ->
71
71
    PadResult = pad_file(File),
72
 
    file:close(File),
 
72
    ok = file:close(File),
73
73
    PadResult;
74
74
close(_) ->
75
75
    {error, einval}.
490
490
                    Ok ->
491
491
                        Ok
492
492
                end,
493
 
            file:close(File),
 
493
            ok = file:close(File),
494
494
            Result;
495
495
        Error ->
496
496
            Error
507
507
 
508
508
table1(eof, _, _, Result) ->
509
509
    {ok, lists:reverse(Result)};
510
 
table1(Header, File, #read_opts{verbose=true}, Result) 
511
 
                                      when is_record(Header, tar_header) ->
 
510
table1(Header = #tar_header{}, File, #read_opts{verbose=true}, Result) ->
512
511
    #tar_header{name=Name, size=Size, mtime=Mtime, typeflag=Type,
513
512
                mode=Mode, uid=Uid, gid=Gid} = Header,
514
513
    skip(File, Size),
515
514
    {ok, [{Name, Type, Size, posix_to_erlang_time(Mtime), Mode, Uid, Gid}|Result]};
516
 
table1(Header, File, _, Result) when is_record(Header, tar_header) ->
517
 
    Name = Header#tar_header.name,
518
 
    skip(File, Header#tar_header.size),
 
515
table1(#tar_header{name=Name, size=Size}, File, _, Result) ->
 
516
    skip(File, Size),
519
517
    {ok, [Name|Result]}.
520
518
 
521
519
extract1(eof, _, _, Acc) ->