Changeset 783


Ignore:
Timestamp:
Aug 31, 2006, 5:09:20 PM (12 years ago)
Author:
bruno
Message:
  • Massive rewrite continues for memory management.
  • main structure should now have all parameters allocated dynamically
  • new lib libmr.a + dir + build process reviewed to support it.
  • new include subdir to host external definitions of the new lib
  • code now compiles. Still one remaining link issues for mondorestore. This should allow for some tests soon.

(goal is to separate completely reviewed code and functions and provide clean interfaces)

Location:
trunk
Files:
1 added
42 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/mondo/Doxyfile

    r30 r783  
    1 # Doxyfile 1.3.2
     1# Generated by doxygen 1.4.4
    22
    3 #---------------------------------------------------------------------------
    4 # General configuration options
    5 #---------------------------------------------------------------------------
    6 PROJECT_NAME           = "Mondo Rescue"
    7 PROJECT_NUMBER         = 2.0x
    8 OUTPUT_DIRECTORY       = doc
    9 OUTPUT_LANGUAGE        = English
    10 USE_WINDOWS_ENCODING   = NO
    11 EXTRACT_ALL            = NO
    12 EXTRACT_PRIVATE        = NO
    13 EXTRACT_STATIC         = NO
    14 EXTRACT_LOCAL_CLASSES  = YES
    15 HIDE_UNDOC_MEMBERS     = NO
    16 HIDE_UNDOC_CLASSES     = NO
    17 HIDE_FRIEND_COMPOUNDS  = NO
    18 HIDE_IN_BODY_DOCS      = YES
    19 BRIEF_MEMBER_DESC      = YES
    20 REPEAT_BRIEF           = YES
    21 ALWAYS_DETAILED_SEC    = YES
    22 INLINE_INHERITED_MEMB  = NO
    23 FULL_PATH_NAMES        = NO
    24 STRIP_FROM_PATH        =
    25 INTERNAL_DOCS          = NO
    26 CASE_SENSE_NAMES       = YES
    27 SHORT_NAMES            = NO
    28 HIDE_SCOPE_NAMES       = NO
    29 SHOW_INCLUDE_FILES     = YES
    30 JAVADOC_AUTOBRIEF      = YES
    31 MULTILINE_CPP_IS_BRIEF = NO
    32 DETAILS_AT_TOP         = NO
    33 INHERIT_DOCS           = YES
    34 INLINE_INFO            = YES
    35 SORT_MEMBER_DOCS       = YES
    36 DISTRIBUTE_GROUP_DOC   = NO
    37 TAB_SIZE               = 4
    38 GENERATE_TODOLIST      = YES
    39 GENERATE_TESTLIST      = YES
    40 GENERATE_BUGLIST       = YES
    41 GENERATE_DEPRECATEDLIST= YES
    42 ALIASES                =
    43 ENABLED_SECTIONS       =
    44 MAX_INITIALIZER_LINES  = 30
    45 OPTIMIZE_OUTPUT_FOR_C  = YES
    46 OPTIMIZE_OUTPUT_JAVA   = NO
    47 SHOW_USED_FILES        = YES
    48 #---------------------------------------------------------------------------
    49 # configuration options related to warning and progress messages
    50 #---------------------------------------------------------------------------
    51 QUIET                  = NO
    52 WARNINGS               = YES
    53 WARN_IF_UNDOCUMENTED   = YES
    54 WARN_IF_DOC_ERROR      = YES
    55 WARN_FORMAT            = "$file:$line: $text"
    56 WARN_LOGFILE           =
    57 #---------------------------------------------------------------------------
    58 # configuration options related to the input files
    59 #---------------------------------------------------------------------------
    60 INPUT                  = mondo/mondo.dox \
    61                          mondo/common/ \
    62                          mondo/mondoarchive/ \
    63                          mondo/mondorestore/
    64 FILE_PATTERNS          = *.c \
    65                          m*.h
    66 RECURSIVE              = YES
    67 EXCLUDE                =
    68 EXCLUDE_SYMLINKS       = NO
    69 EXCLUDE_PATTERNS       =
    70 EXAMPLE_PATH           =
    71 EXAMPLE_PATTERNS       =
    72 EXAMPLE_RECURSIVE      = NO
    73 IMAGE_PATH             =
    74 INPUT_FILTER           =
    75 FILTER_SOURCE_FILES    = NO
    76 #---------------------------------------------------------------------------
    77 # configuration options related to source browsing
    78 #---------------------------------------------------------------------------
    79 SOURCE_BROWSER         = YES
    80 INLINE_SOURCES         = NO
    81 STRIP_CODE_COMMENTS    = YES
    82 REFERENCED_BY_RELATION = YES
    83 REFERENCES_RELATION    = YES
    84 VERBATIM_HEADERS       = YES
    85 #---------------------------------------------------------------------------
    86 # configuration options related to the alphabetical class index
    87 #---------------------------------------------------------------------------
    88 ALPHABETICAL_INDEX     = NO
    89 COLS_IN_ALPHA_INDEX    = 5
    90 IGNORE_PREFIX          =
    91 #---------------------------------------------------------------------------
    92 # configuration options related to the HTML output
    93 #---------------------------------------------------------------------------
    94 GENERATE_HTML          = YES
    95 HTML_OUTPUT            = html
    96 HTML_FILE_EXTENSION    = .html
    97 HTML_HEADER            =
    98 HTML_FOOTER            =
    99 HTML_STYLESHEET        =
    100 HTML_ALIGN_MEMBERS     = YES
    101 GENERATE_HTMLHELP      = NO
    102 CHM_FILE               =
    103 HHC_LOCATION           =
    104 GENERATE_CHI           = NO
    105 BINARY_TOC             = NO
    106 TOC_EXPAND             = NO
    107 DISABLE_INDEX          = NO
    108 ENUM_VALUES_PER_LINE   = 4
    109 GENERATE_TREEVIEW      = YES
    110 TREEVIEW_WIDTH         = 250
    111 #---------------------------------------------------------------------------
    112 # configuration options related to the LaTeX output
    113 #---------------------------------------------------------------------------
    114 GENERATE_LATEX         = YES
    115 LATEX_OUTPUT           = latex
    116 LATEX_CMD_NAME         = latex
    117 MAKEINDEX_CMD_NAME     = makeindex
    118 COMPACT_LATEX          = NO
    119 PAPER_TYPE             = a4wide
    120 EXTRA_PACKAGES         =
    121 LATEX_HEADER           =
    122 PDF_HYPERLINKS         = NO
    123 USE_PDFLATEX           = NO
    124 LATEX_BATCHMODE        = NO
    125 LATEX_HIDE_INDICES     = NO
    126 #---------------------------------------------------------------------------
    127 # configuration options related to the RTF output
    128 #---------------------------------------------------------------------------
    129 GENERATE_RTF           = NO
    130 RTF_OUTPUT             = rtf
    131 COMPACT_RTF            = NO
    132 RTF_HYPERLINKS         = NO
    133 RTF_STYLESHEET_FILE    =
    134 RTF_EXTENSIONS_FILE    =
    135 #---------------------------------------------------------------------------
    136 # configuration options related to the man page output
    137 #---------------------------------------------------------------------------
    138 GENERATE_MAN           = YES
    139 MAN_OUTPUT             = man
    140 MAN_EXTENSION          = .3
    141 MAN_LINKS              = NO
    142 #---------------------------------------------------------------------------
    143 # configuration options related to the XML output
    144 #---------------------------------------------------------------------------
    145 GENERATE_XML           = YES
    146 XML_OUTPUT             = xml
    147 XML_SCHEMA             =
    148 XML_DTD                =
    149 #---------------------------------------------------------------------------
    150 # configuration options for the AutoGen Definitions output
    151 #---------------------------------------------------------------------------
    152 GENERATE_AUTOGEN_DEF   = NO
    153 #---------------------------------------------------------------------------
    154 # configuration options related to the Perl module output
    155 #---------------------------------------------------------------------------
    156 GENERATE_PERLMOD       = NO
    157 PERLMOD_LATEX          = NO
    158 PERLMOD_PRETTY         = YES
    159 PERLMOD_MAKEVAR_PREFIX =
    160 #---------------------------------------------------------------------------
    161 # Configuration options related to the preprocessor   
    162 #---------------------------------------------------------------------------
    163 ENABLE_PREPROCESSING   = YES
    164 MACRO_EXPANSION        = NO
    165 EXPAND_ONLY_PREDEF     = NO
    166 SEARCH_INCLUDES        = YES
    167 INCLUDE_PATH           =
    168 INCLUDE_FILE_PATTERNS  =
    169 PREDEFINED             = linux
    170 EXPAND_AS_DEFINED      =
    171 SKIP_FUNCTION_MACROS   = YES
    172 #---------------------------------------------------------------------------
    173 # Configuration::addtions related to external references   
    174 #---------------------------------------------------------------------------
    175 TAGFILES               =
    176 GENERATE_TAGFILE       =
    177 ALLEXTERNALS           = NO
    178 EXTERNAL_GROUPS        = YES
    179 PERL_PATH              = /usr/bin/perl
    180 #---------------------------------------------------------------------------
    181 # Configuration options related to the dot tool   
    182 #---------------------------------------------------------------------------
    183 CLASS_DIAGRAMS         = YES
    184 HIDE_UNDOC_RELATIONS   = YES
    185 HAVE_DOT               = YES
    186 CLASS_GRAPH            = YES
    187 COLLABORATION_GRAPH    = YES
    188 UML_LOOK               = NO
    189 TEMPLATE_RELATIONS     = NO
    190 INCLUDE_GRAPH          = YES
    191 INCLUDED_BY_GRAPH      = YES
    192 CALL_GRAPH             = NO
    193 GRAPHICAL_HIERARCHY    = YES
    194 DOT_IMAGE_FORMAT       = png
    195 DOT_PATH               =
    196 DOTFILE_DIRS           =
    197 MAX_DOT_GRAPH_WIDTH    = 1024
    198 MAX_DOT_GRAPH_HEIGHT   = 1024
    199 MAX_DOT_GRAPH_DEPTH    = 0
    200 GENERATE_LEGEND        = YES
    201 DOT_CLEANUP            = YES
    202 #---------------------------------------------------------------------------
    203 # Configuration::addtions related to the search engine   
    204 #---------------------------------------------------------------------------
    205 SEARCHENGINE           = NO
    206 CGI_NAME               = search.cgi
    207 CGI_URL                =
    208 DOC_URL                =
    209 DOC_ABSPATH            =
    210 BIN_ABSPATH            = /usr/local/bin/
    211 EXT_DOC_PATHS          =
     3# This file describes styles used for generating RTF output.
     4# All text after a hash (#) is considered a comment and will be ignored.
     5# Remove a hash to activate a line.
     6
     7# Heading1 = \s1\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs36\kerning36\cgrid \sbasedon0 \snext0 heading 1
     8# Heading2 = \s2\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs28\kerning28\cgrid \sbasedon0 \snext0 heading 2
     9# Heading3 = \s3\sb240\sa60\keepn\widctlpar\adjustright \b\f1\cgrid \sbasedon0 \snext0 heading 3
     10# Heading4 = \s4\sb240\sa60\keepn\widctlpar\adjustright \b\f1\fs20\cgrid \sbasedon0 \snext0 heading 4;}{\*\cs10 \additive Default Paragraph Font
     11# Heading5 = \s5\sb90\sa30\keepn\widctlpar\adjustright \b\f1\fs20\cgrid \sbasedon0 \snext0 heading 5;}{\*\cs10 \additive Default Paragraph Font
     12# Title = \s15\qc\sb240\sa60\widctlpar\outlinelevel0\adjustright \b\f1\fs32\kerning28\cgrid \sbasedon0 \snext15 Title
     13# SubTitle = \s16\qc\sa60\widctlpar\outlinelevel1\adjustright \f1\cgrid \sbasedon0 \snext16 Subtitle
     14# BodyText = \s17\sa60\sb30\widctlpar\qj \fs22\cgrid \sbasedon0 \snext17 BodyText
     15# DenseText = \s18\widctlpar\fs22\cgrid \sbasedon0 \snext18 DenseText
     16# Header = \s28\widctlpar\tqc\tx4320\tqr\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext28 header
     17# Footer = \s29\widctlpar\tqc\tx4320\tqr\tx8640\qr\adjustright \fs20\cgrid \sbasedon0 \snext29 footer
     18# GroupHeader = \s30\li360\sa60\sb120\keepn\widctlpar\adjustright \b\f1\fs20\cgrid \sbasedon0 \snext30 GroupHeader
     19# CodeExample0 = \s40\li0\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext41 Code Example 0
     20# CodeExample1 = \s41\li360\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext42 Code Example 1
     21# CodeExample2 = \s42\li720\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext43 Code Example 2
     22# CodeExample3 = \s43\li1080\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext44 Code Example 3
     23# CodeExample4 = \s44\li1440\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext45 Code Example 4
     24# CodeExample5 = \s45\li1800\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext46 Code Example 5
     25# CodeExample6 = \s46\li2160\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext47 Code Example 6
     26# CodeExample7 = \s47\li2520\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext48 Code Example 7
     27# CodeExample8 = \s48\li2880\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext49 Code Example 8
     28# CodeExample9 = \s49\li3240\widctlpar\adjustright \shading1000\cbpat8 \f2\fs16\cgrid \sbasedon0 \snext49 Code Example 9
     29# ListContinue0 = \s50\li0\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext51 List Continue 0
     30# ListContinue1 = \s51\li360\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext52 List Continue 1
     31# ListContinue2 = \s52\li720\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext53 List Continue 2
     32# ListContinue3 = \s53\li1080\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext54 List Continue 3
     33# ListContinue4 = \s54\li1440\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext55 List Continue 4
     34# ListContinue5 = \s55\li1800\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext56 List Continue 5
     35# ListContinue6 = \s56\li2160\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext57 List Continue 6
     36# ListContinue7 = \s57\li2520\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext58 List Continue 7
     37# ListContinue8 = \s58\li2880\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext59 List Continue 8
     38# ListContinue9 = \s59\li3240\sa60\sb30\qj\widctlpar\qj\adjustright \fs20\cgrid \sbasedon0 \snext59 List Continue 9
     39# DescContinue0 = \s60\li0\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext61 DescContinue 0
     40# DescContinue1 = \s61\li360\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext62 DescContinue 1
     41# DescContinue2 = \s62\li720\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext63 DescContinue 2
     42# DescContinue3 = \s63\li1080\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext64 DescContinue 3
     43# DescContinue4 = \s64\li1440\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext65 DescContinue 4
     44# DescContinue5 = \s65\li1800\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext66 DescContinue 5
     45# DescContinue6 = \s66\li2160\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext67 DescContinue 6
     46# DescContinue7 = \s67\li2520\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext68 DescContinue 7
     47# DescContinue8 = \s68\li2880\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext69 DescContinue 8
     48# DescContinue9 = \s69\li3240\widctlpar\ql\adjustright \fs20\cgrid \sbasedon0 \snext69 DescContinue 9
     49# LatexTOC0 = \s70\li0\sa30\sb30\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext81 LatexTOC 0
     50# LatexTOC1 = \s71\li360\sa27\sb27\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext82 LatexTOC 1
     51# LatexTOC2 = \s72\li720\sa24\sb24\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext83 LatexTOC 2
     52# LatexTOC3 = \s73\li1080\sa21\sb21\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext84 LatexTOC 3
     53# LatexTOC4 = \s74\li1440\sa18\sb18\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext85 LatexTOC 4
     54# LatexTOC5 = \s75\li1800\sa15\sb15\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext86 LatexTOC 5
     55# LatexTOC6 = \s76\li2160\sa12\sb12\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext87 LatexTOC 6
     56# LatexTOC7 = \s77\li2520\sa9\sb9\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext88 LatexTOC 7
     57# LatexTOC8 = \s78\li2880\sa6\sb6\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext89 LatexTOC 8
     58# LatexTOC9 = \s79\li3240\sa3\sb3\widctlpar\tqr\tldot\tx8640\adjustright \fs20\cgrid \sbasedon0 \snext89 LatexTOC 9
     59# ListBullet0 = \s80\fi-360\li360\widctlpar\jclisttab\tx360{\*\pn \pnlvlbody\ilvl0\ls1\pnrnot0\pndec }\ls1\adjustright \fs20\cgrid \sbasedon0 \snext81 \sautoupd List Bullet 0
     60# ListBullet1 = \s81\fi-360\li720\widctlpar\jclisttab\tx720{\*\pn \pnlvlbody\ilvl0\ls2\pnrnot0\pndec }\ls2\adjustright \fs20\cgrid \sbasedon0 \snext82 \sautoupd List Bullet 1
     61# ListBullet2 = \s82\fi-360\li1080\widctlpar\jclisttab\tx1080{\*\pn \pnlvlbody\ilvl0\ls3\pnrnot0\pndec }\ls3\adjustright \fs20\cgrid \sbasedon0 \snext83 \sautoupd List Bullet 2
     62# ListBullet3 = \s83\fi-360\li1440\widctlpar\jclisttab\tx1440{\*\pn \pnlvlbody\ilvl0\ls4\pnrnot0\pndec }\ls4\adjustright \fs20\cgrid \sbasedon0 \snext84 \sautoupd List Bullet 3
     63# ListBullet4 = \s84\fi-360\li1800\widctlpar\jclisttab\tx1800{\*\pn \pnlvlbody\ilvl0\ls5\pnrnot0\pndec }\ls5\adjustright \fs20\cgrid \sbasedon0 \snext85 \sautoupd List Bullet 4
     64# ListBullet5 = \s85\fi-360\li2160\widctlpar\jclisttab\tx2160{\*\pn \pnlvlbody\ilvl0\ls6\pnrnot0\pndec }\ls6\adjustright \fs20\cgrid \sbasedon0 \snext86 \sautoupd List Bullet 5
     65# ListBullet6 = \s86\fi-360\li2520\widctlpar\jclisttab\tx2520{\*\pn \pnlvlbody\ilvl0\ls7\pnrnot0\pndec }\ls7\adjustright \fs20\cgrid \sbasedon0 \snext87 \sautoupd List Bullet 6
     66# ListBullet7 = \s87\fi-360\li2880\widctlpar\jclisttab\tx2880{\*\pn \pnlvlbody\ilvl0\ls8\pnrnot0\pndec }\ls8\adjustright \fs20\cgrid \sbasedon0 \snext88 \sautoupd List Bullet 7
     67# ListBullet8 = \s88\fi-360\li3240\widctlpar\jclisttab\tx3240{\*\pn \pnlvlbody\ilvl0\ls9\pnrnot0\pndec }\ls9\adjustright \fs20\cgrid \sbasedon0 \snext89 \sautoupd List Bullet 8
     68# ListBullet9 = \s89\fi-360\li3600\widctlpar\jclisttab\tx3600{\*\pn \pnlvlbody\ilvl0\ls10\pnrnot0\pndec }\ls10\adjustright \fs20\cgrid \sbasedon0 \snext89 \sautoupd List Bullet 9
     69# ListEnum0 = \s90\fi-360\li360\widctlpar\fs20\cgrid \sbasedon0 \snext91 \sautoupd List Enum 0
     70# ListEnum1 = \s91\fi-360\li720\widctlpar\fs20\cgrid \sbasedon0 \snext92 \sautoupd List Enum 1
     71# ListEnum2 = \s92\fi-360\li1080\widctlpar\fs20\cgrid \sbasedon0 \snext93 \sautoupd List Enum 2
     72# ListEnum3 = \s93\fi-360\li1440\widctlpar\fs20\cgrid \sbasedon0 \snext94 \sautoupd List Enum 3
     73# ListEnum4 = \s94\fi-360\li1800\widctlpar\fs20\cgrid \sbasedon0 \snext95 \sautoupd List Enum 4
     74# ListEnum5 = \s95\fi-360\li2160\widctlpar\fs20\cgrid \sbasedon0 \snext96 \sautoupd List Enum 5
     75# ListEnum6 = \s96\fi-360\li2520\widctlpar\fs20\cgrid \sbasedon0 \snext96 \sautoupd List Enum 5
     76# ListEnum7 = \s97\fi-360\li2880\widctlpar\fs20\cgrid \sbasedon0 \snext98 \sautoupd List Enum 7
     77# ListEnum8 = \s98\fi-360\li3240\widctlpar\fs20\cgrid \sbasedon0 \snext99 \sautoupd List Enum 8
     78# ListEnum9 = \s99\fi-360\li3600\widctlpar\fs20\cgrid \sbasedon0 \snext99 \sautoupd List Enum 9
  • trunk/mondo/Makefile.am

    r537 r783  
    66
    77EXTRA_DIST = config.rpath mkinstalldirs
     8
     9
  • trunk/mondo/configure.in

    r561 r783  
    125125AC_TYPE_SIGNAL
    126126AC_FUNC_VPRINTF
    127 AC_CHECK_FUNCS([bzero getcwd memmove memset mkdir mkfifo setenv strcasecmp strchr strerror strrchr strstr getline asprintf trunc vasprintf])
     127AC_CHECK_FUNCS([bzero getcwd memmove memset mkdir mkfifo setenv strcasecmp strchr strerror strrchr strstr strspn getline asprintf trunc vasprintf])
    128128
    129 AC_OUTPUT([Makefile mondo/Makefile mondo/common/Makefile mondo/mondoarchive/Makefile mondo/mondorestore/Makefile mondo/restore-scripts/Makefile mondo/restore-scripts/mondo/Makefile mondo/restore-scripts/usr/Makefile mondo/restore-scripts/usr/bin/Makefile mondo/post-nuke.sample/Makefile mondo/post-nuke.sample/usr/Makefile mondo/post-nuke.sample/usr/bin/Makefile po/Makefile.in m4/Makefile])
     129AC_OUTPUT([Makefile mondo/Makefile mondo/common/Makefile mondo/lib/Makefile mondo/mondoarchive/Makefile mondo/mondorestore/Makefile mondo/restore-scripts/Makefile mondo/restore-scripts/mondo/Makefile mondo/restore-scripts/usr/Makefile mondo/restore-scripts/usr/bin/Makefile mondo/post-nuke.sample/Makefile mondo/post-nuke.sample/usr/Makefile mondo/post-nuke.sample/usr/bin/Makefile])
  • trunk/mondo/mondo/Makefile.am

    r764 r783  
    1 SUBDIRS        = common mondoarchive mondorestore restore-scripts post-nuke.sample
     1SUBDIRS        = lib common mondoarchive mondorestore restore-scripts post-nuke.sample
    22DIST_SUBDIRS   = ${SUBDIRS}
    33
  • trunk/mondo/mondo/common/Makefile.am

    r539 r783  
    22## Process this file with Automake to generate `Makefile.in'
    33##
    4 AM_CPPFLAGS = -DMONDO_SHARE=\"$(pkgdatadir)\"
     4AM_CPPFLAGS = -DMONDO_SHARE=\"$(pkgdatadir)\" -DMONDO_CONF_DIR=\"$(sysconfdir)\" -I${top_builddir}/mondo/include
    55
    66## libmondo
     
    88
    99libmondo_a_SOURCES  = libmondo-archive.c libmondo-devices.c libmondo-fifo.c \
    10                        libmondo-filelist.c libmondo-files.c libmondo-fork.c \
    11                        libmondo-mountlist.c libmondo-raid.c libmondo-msg.c \
    12                        libmondo-stream.c libmondo-string.c libmondo-tools.c \
    13                        libmondo-verify.c newt-specific.c \
    14                        libmondo-archive.h libmondo-devices.h \
    15                        libmondo-filelist.h libmondo-files.h libmondo-fork.h \
    16                        libmondo-mountlist.h libmondo-raid.h \
    17                        libmondo-stream.h libmondo-string.h libmondo-tools.h \
    18                        libmondo-verify.h libmondo-fifo.h \
    19                        libmondo-archive-EXT.h my-stuff.h mondostructures.h \
    20                        libmondo-devices-EXT.h libmondo-fifo-EXT.h \
    21                        libmondo-files-EXT.h libmondo-fork-EXT.h \
    22                        libmondo-filelist-EXT.h \
    23                        libmondo-mountlist-EXT.h libmondo-raid-EXT.h  \
    24                        libmondo-string-EXT.h libmondo-tools-EXT.h \
    25                        libmondo-verify-EXT.h  libmondo-stream-EXT.h \
    26                        newt-specific.h
     10                    libmondo-filelist.c libmondo-files.c libmondo-fork.c \
     11                    libmondo-mountlist.c libmondo-raid.c libmondo-msg.c \
     12                    libmondo-stream.c libmondo-string.c libmondo-tools.c \
     13                    libmondo-verify.c newt-specific.c \
     14                    libmondo-archive.h libmondo-devices.h \
     15                    libmondo-filelist.h libmondo-files.h libmondo-fork.h \
     16                    libmondo-mountlist.h libmondo-raid.h \
     17                    libmondo-stream.h libmondo-string.h libmondo-tools.h \
     18                    libmondo-verify.h libmondo-fifo.h \
     19                    libmondo-archive-EXT.h my-stuff.h mondostructures.h \
     20                    libmondo-devices-EXT.h libmondo-fifo-EXT.h \
     21                    libmondo-files-EXT.h libmondo-fork-EXT.h \
     22                    libmondo-filelist-EXT.h \
     23                    libmondo-mountlist-EXT.h libmondo-raid-EXT.h  \
     24                    libmondo-string-EXT.h libmondo-tools-EXT.h \
     25                    libmondo-verify-EXT.h  libmondo-stream-EXT.h \
     26                    newt-specific.h
  • trunk/mondo/mondo/common/libmondo-archive-EXT.h

    r539 r783  
    1515extern int make_slices_and_images(struct s_bkpinfo *bkpinfo,
    1616                                  char *biggielist_fname);
    17 extern int make_iso_fs(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *destfile);
     17extern int make_iso_fs(struct s_bkpinfo *bkpinfo, char *destfile);
    1818extern int make_afioballs_and_images(struct s_bkpinfo *bkpinfo);
    1919extern int (*move_files_to_cd) (struct s_bkpinfo *, char *, ...);
  • trunk/mondo/mondo/common/libmondo-archive.c

    r729 r783  
    1010 */
    1111
    12 #include "../common/my-stuff.h"
     12#include "my-stuff.h"
    1313#include "../common/mondostructures.h"
     14#include "mr_conf.h"
    1415#include "libmondo-string-EXT.h"
    1516#include "libmondo-stream-EXT.h"
     
    8081 */
    8182t_bkptype g_backup_media_type = none;
     83char *g_backup_media_string = NULL;
    8284
    8385/**
     
    231233        log_msg(5, "command='%s'", command);
    232234        res = system(command);
    233         tmp = last_line_of_file(MONDO_LOGFILE));
     235        tmp = last_line_of_file(MONDO_LOGFILE);
    234236        log_msg(1, "res=%d; tmp='%s'", res, tmp);
    235237        if (bkpinfo->use_star && (res == 254 || res == 65024)
     
    390392    }
    391393
    392     if (g_tmpfs_mountpt[0] != '\0') {
     394    if (g_tmpfs_mountpt != NULL) {
    393395        tmp = call_program_and_get_last_line_of_output
    394396                 ("df -m -P | grep dev/shm | grep -v none | tr -s ' ' '\t' | cut -f4");
     
    424426 * @ingroup archiveGroup
    425427 */
    426 int backup_data(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf)
     428int backup_data(struct s_bkpinfo *bkpinfo)
    427429{
    428430    int retval = 0, res = 0;
     
    651653        else
    652654            ch = 'U';
     655
    653656        if (bkpinfo->boot_loader != '\0') {
    654657            asprintf(&tmp, "User specified boot loader. It is '%c'.",
     
    743746    }
    744747    paranoid_free(tmp);
     748    /* BERLIOS: Use bkptype_to_string without LANG */
    745749    switch (bkpinfo->backup_media_type) {
    746750    case cdr:
     
    11061110 * @ingroup MLarchiveGroup
    11071111 */
    1108 int do_that_final_phase(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf)
     1112int do_that_final_phase(struct s_bkpinfo *bkpinfo)
    11091113{
    11101114
     
    11251129    } else {
    11261130        /* write final ISO */
    1127         res = write_final_iso_if_necessary(bkpinfo, mrconf);
     1131        res = write_final_iso_if_necessary(bkpinfo);
    11281132        retval += res;
    11291133        if (res) {
     
    11781182    g_serial_string = call_program_and_get_last_line_of_output("dd \
    11791183if=/dev/urandom bs=16 count=1 2> /dev/null | \
    1180 hexdump | tr -s ' ' '0' | head -n1"));
     1184hexdump | tr -s ' ' '0' | head -n1");
    11811185    asprintf(&tmp, "%s...word.", g_serial_string);
    11821186    paranoid_free(g_serial_string);
     
    12691273    }
    12701274/* if not Debian then go ahead & use fdformat */
    1271     tempfile = call_program_and_get_last_line_of_output("mktemp -q /tmp/mondo.XXXXXXXX"));
     1275    tempfile = call_program_and_get_last_line_of_output("mktemp -q /tmp/mondo.XXXXXXXX");
    12721276    asprintf(&command, "%s >> %s 2>> %s; rm -f %s", cmd, tempfile,
    12731277             tempfile, tempfile);
     
    12941298        if (trackno <= 5 && last_trkno > 40) {
    12951299            close_evalcall_form();
    1296             strcpy(title, "Verifying format");
    1297             open_evalcall_form(title);
     1300            open_evalcall_form("Verifying format");
    12981301        }
    12991302        last_trkno = trackno;
     
    14011404 * @return The number of errors encountered (0 for success)
    14021405 */
    1403 int make_afioballs_and_images(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf)
     1406int make_afioballs_and_images(struct s_bkpinfo *bkpinfo)
    14041407{
    14051408
     
    15441547            } else {
    15451548                res =
    1546                     move_files_to_cd(bkpinfo, mrconf, storing_filelist_fname,
     1549                    move_files_to_cd(bkpinfo, storing_filelist_fname,
    15471550                                     curr_xattr_list_fname,
    15481551                                     curr_acl_list_fname,
     
    16241627 * @return The number of errors encountered (0 for success)
    16251628 */
    1626 int make_iso_fs(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *destfile)
     1629int make_iso_fs(struct s_bkpinfo *bkpinfo, char *destfile)
    16271630{
    16281631    /*@ int ********************************************** */
     
    16671670    /* BERLIOS: Do not ignore getcwd result */
    16681671    (void) getcwd(old_pwd, MAX_STR_LEN - 1);
    1669     asprintf(&tmp, "chmod 744 %s", bkpinfo->scratchdir);
     1672    asprintf(&tmp, "chmod 755 %s", bkpinfo->scratchdir);
    16701673    run_program_and_log_output(tmp, FALSE);
    16711674    paranoid_free(tmp);
    16721675    chdir(bkpinfo->scratchdir);
    16731676
    1674     if (bkpinfo->call_before_iso[0] != '\0') {
     1677    if (bkpinfo->call_before_iso != NULL) {
    16751678        asprintf(&message_to_screen, "Running pre-ISO call for CD#%d",
    16761679                 g_current_media_number);
     
    16871690    }
    16881691
    1689     if (bkpinfo->call_make_iso[0] != '\0') {
     1692    if (bkpinfo->call_make_iso != NULL) {
    16901693        log_msg(2, "bkpinfo->call_make_iso = %s", bkpinfo->call_make_iso);
    16911694        asprintf(&tmp, "%s/archives/NOT-THE-LAST", bkpinfo->scratchdir);
    16921695        asprintf(&message_to_screen, "Making an ISO (%s #%d)",
    1693                  media_descriptor_string(bkpinfo->backup_media_type),
     1696                 bkpinfo->backup_media_string,
    16941697                 g_current_media_number);
    16951698
     
    17891792    } else {
    17901793        asprintf(&message_to_screen, "Running mkisofs to make %s #%d",
    1791                  media_descriptor_string(bkpinfo->backup_media_type),
     1794                 bkpinfo->backup_media_string,
    17921795                 g_current_media_number);
    17931796        log_msg(1, message_to_screen);
    17941797        asprintf(&result_sz, "Call to mkisofs to make ISO (%s #%d) ",
    1795                  media_descriptor_string(bkpinfo->backup_media_type),
     1798                 bkpinfo->backup_media_string,
    17961799                 g_current_media_number);
    17971800        if (bkpinfo->nonbootable_backup) {
     
    18181821#ifdef __IA64__
    18191822                log_msg(1, "IA64 --> elilo");
    1820                 asprintf(&tmp2,"mkisofs -no-emul-boot -b images/mindi-bootroot.%s.img -c boot.cat -o _ISO_ -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", mrconf->ia64_boot_size);
     1823                asprintf(&tmp2,"mkisofs -no-emul-boot -b images/mindi-bootroot.%s.img -c boot.cat -o _ISO_ -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", bkpinfo->mrconf->mindi_ia64_boot_size);
    18211824                res = eval_call_to_make_ISO(bkpinfo,
    18221825                                            tmp2,
     
    18701873    }
    18711874
    1872     if (bkpinfo->call_burn_iso[0] != '\0') {
     1875    if (bkpinfo->call_burn_iso != NULL) {
    18731876        log_msg(2, "bkpinfo->call_burn_iso = %s", bkpinfo->call_burn_iso);
    18741877        asprintf(&message_to_screen, "Burning %s #%d",
    1875                  media_descriptor_string(bkpinfo->backup_media_type),
     1878                 bkpinfo->backup_media_string,
    18761879                 g_current_media_number);
    18771880        pause_and_ask_for_cdr(2, &cd_is_mountable);
     
    18881891    }
    18891892
    1890     if (bkpinfo->call_after_iso[0] != '\0') {
     1893    if (bkpinfo->call_after_iso != NULL) {
    18911894        asprintf(&message_to_screen, "Running post-ISO call (%s #%d)",
    1892                  media_descriptor_string(bkpinfo->backup_media_type),
     1895                 bkpinfo->backup_media_string,
    18931896                 g_current_media_number);
    18941897        res = eval_call_to_make_ISO(bkpinfo, bkpinfo->call_after_iso,
     
    19221925             bigfile_fname);
    19231926    log_msg(1, "command = '%s'", command);
    1924     tmp = call_program_and_get_last_line_of_output(command));
     1927    tmp = call_program_and_get_last_line_of_output(command);
    19251928    log_msg(1, "--> tmp = '%s'", tmp);
    19261929    paranoid_free(command);
     
    19511954 */
    19521955int
    1953 make_slices_and_images(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *biggielist_fname)
     1956make_slices_and_images(struct s_bkpinfo *bkpinfo, char *biggielist_fname)
    19541957{
    19551958
     
    20702073            }
    20712074            res =
    2072                 slice_up_file_etc(bkpinfo, mrconf, bigfile_fname,
     2075                slice_up_file_etc(bkpinfo, bigfile_fname,
    20732076                                  ntfsprog_fifo, biggie_file_number,
    20742077                                  noof_biggie_files, use_ntfsprog);
     
    21192122 * @see make_afioballs_and_images
    21202123 */
    2121 int make_afioballs_and_images_OLD(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf)
     2124int make_afioballs_and_images_OLD(struct s_bkpinfo *bkpinfo)
    21222125{
    21232126
     
    21932196        } else {
    21942197            res =
    2195                 move_files_to_cd(bkpinfo, mrconf, curr_filelist_fname,
     2198                move_files_to_cd(bkpinfo, curr_filelist_fname,
    21962199                                 curr_xattr_list_fname,
    21972200                                 curr_acl_list_fname, curr_afioball_fname,
     
    22412244 * @ingroup MLarchiveGroup
    22422245 */
    2243 int make_those_afios_phase(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf)
     2246int make_those_afios_phase(struct s_bkpinfo *bkpinfo)
    22442247{
    22452248    /*@ int ******************************************* */
     
    22582261        log_msg(1,
    22592262                "Using single-threaded make_afioballs_and_images() to suit b0rken FreeBSD 5.0");
    2260         res = make_afioballs_and_images_OLD(bkpinfo, mrconf);
     2263        res = make_afioballs_and_images_OLD(bkpinfo);
    22612264#else
    2262         res = make_afioballs_and_images_OLD(bkpinfo, mrconf);
     2265        res = make_afioballs_and_images_OLD(bkpinfo);
    22632266#endif
    22642267        write_header_block_to_stream((off_t)0, "stop-afioballs",
    22652268                                     BLK_STOP_AFIOBALLS);
    22662269    } else {
    2267         res = make_afioballs_and_images(bkpinfo, mrconf);
     2270        res = make_afioballs_and_images(bkpinfo);
    22682271    }
    22692272
     
    23712374 * transfer files over the network) or leave it as is.
    23722375 */
    2373 int (*move_files_to_cd) (struct s_bkpinfo *, struct s_mrconf *mrconf, char *, ...) =
     2376int (*move_files_to_cd) (struct s_bkpinfo *, char *, ...) =
    23742377    _move_files_to_cd;
    23752378
     
    23922395 * @return The number of errors encountered (0 for success)
    23932396 */
    2394 int _move_files_to_cd(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *files_to_add, ...)
     2397int _move_files_to_cd(struct s_bkpinfo *bkpinfo, char *files_to_add, ...)
    23952398{
    23962399
     
    24312434    if (would_occupy / 1024 > bkpinfo->media_size[g_current_media_number]) {
    24322435        /* FALSE because this is not the last CD we'll write */
    2433         res = write_iso_and_go_on(bkpinfo, mrconf, FALSE);
     2436        res = write_iso_and_go_on(bkpinfo, FALSE);
    24342437        retval += res;
    24352438        if (res) {
     
    28232826
    28242827    asprintf(&szmsg, "I am about to burn %s #%d",
    2825              media_descriptor_string(g_backup_media_type),
     2828             g_backup_media_string,
    28262829             g_current_media_number);
    28272830    log_to_screen(szmsg);
     
    28602863            log_to_screen
    28612864                ("%s has data on it but it's probably not a Mondo CD.",
    2862                  media_descriptor_string(g_backup_media_type));
     2865                 g_backup_media_string);
    28632866            asprintf(&our_serial_str, "%s", "");
    28642867        } else {
    28652868            log_to_screen("%s found in drive. It's a Mondo disk.",
    2866                           media_descriptor_string(g_backup_media_type));
     2869                          g_backup_media_string);
    28672870            tmp1 = last_line_of_file(szcdno);
    28682871            cd_number = atoi(tmp1);
     
    28852888        if (cd_number > 0 && !strcmp(our_serial_str, g_serial_string)) {
    28862889            log_msg(2, "This %s is part of this backup set!",
    2887                     media_descriptor_string(g_backup_media_type));
     2890                    g_backup_media_string);
    28882891            ok_go_ahead_burn_it = FALSE;
    28892892            if (cd_number == g_current_media_number - 1) {
    28902893                log_to_screen
    28912894                    ("I think you've left the previous %s in the drive.",
    2892                      media_descriptor_string(g_backup_media_type));
     2895                     g_backup_media_string);
    28932896            } else {
    28942897                log_to_screen
    28952898                    ("Please remove this %s. It is part of the backup set you're making now.",
    2896                      media_descriptor_string(g_backup_media_type));
     2899                     g_backup_media_string);
    28972900            }
    28982901        } else {
     
    29032906        log_msg(2,
    29042907                "paafcd: Can't find CD-ROM drive. Perhaps it has a blank %s in it?",
    2905                 media_descriptor_string(g_backup_media_type));
     2908                g_backup_media_string);
    29062909        if ((cdrw_device = interrogate_disk_currently_in_cdrw_drive(cdrw_device)) != NULL) {
    29072910            ok_go_ahead_burn_it = FALSE;
    29082911            log_to_screen("There isn't a writable %s in the drive.",
    2909                           media_descriptor_string(g_backup_media_type));
     2912                          g_backup_media_string);
    29102913        }
    29112914        paranoid_free(cdrw_device);
     
    29172920        asprintf(&tmp,
    29182921                 "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.",
    2919                  media_descriptor_string(g_backup_media_type),
     2922                 g_backup_media_string,
    29202923                 g_current_media_number,
    2921                  media_descriptor_string(g_backup_media_type));
     2924                 g_backup_media_string);
    29222925        popup_and_OK(tmp);
    29232926        paranoid_free(tmp);
     
    29302933    log_msg(2,
    29312934            "paafcd: OK, I assume I have a blank/reusable %s in the drive...",
    2932             media_descriptor_string(g_backup_media_type));
     2935            g_backup_media_string);
    29332936
    29342937    log_to_screen("Proceeding w/ %s in drive.",
    2935                   media_descriptor_string(g_backup_media_type));
     2938                  g_backup_media_string);
    29362939    if (pmountable) {
    29372940        if (attempt_to_mount_returned_this) {
     
    29942997 */
    29952998int
    2996 slice_up_file_etc(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *biggie_filename,
     2999slice_up_file_etc(struct s_bkpinfo *bkpinfo, char *biggie_filename,
    29973000                  char *ntfsprog_fifo, long biggie_file_number,
    29983001                  long noof_biggie_files, bool use_ntfsprog)
     
    30923095    }
    30933096    lstat(biggie_filename, &biggiestruct.properties);
    3094     strcpy(biggiestruct.filename, biggie_filename);
     3097    if (strlen(checksum_line) <= MAX_STR_LEN) {
     3098        strcpy(biggiestruct.filename, biggie_filename);
     3099    } else {
     3100        fatal_error("biggie_filename too big");
     3101    }
    30953102    pB = strchr(checksum_line, ' ');
    30963103    if (!pB) {
     
    31003107        *pB = '\0';
    31013108    }
    3102     strcpy(biggiestruct.checksum, checksum_line);
     3109    if (strlen(checksum_line) <= 64) {
     3110        strcpy(biggiestruct.checksum, checksum_line);
     3111    } else {
     3112        fatal_error("checksum_line too big");
     3113    }
    31033114    paranoid_free(checksum_line);
    31043115
     
    31253136        res = move_files_to_stream(bkpinfo,tmp,NULL);
    31263137    } else {
    3127         res = move_files_to_cd(bkpinfo, mrconf, tmp, NULL);
     3138        res = move_files_to_cd(bkpinfo, tmp, NULL);
    31283139    }
    31293140    paranoid_free(tmp);
     
    31313142    for (slice_num = 1; !finished; slice_num++) {
    31323143        curr_slice_fname_uncompressed = slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, "");
    3133         curr_slice_fname_compressed = slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix));
     3144        curr_slice_fname_compressed = slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix);
    31343145
    31353146        tmp = percent_media_full_comment(bkpinfo);
     
    32363247            res = move_files_to_stream(bkpinfo, file_to_archive, NULL);
    32373248        } else {
    3238             res = move_files_to_cd(bkpinfo, mrconf, file_to_archive, NULL);
     3249            res = move_files_to_cd(bkpinfo, file_to_archive, NULL);
    32393250        }
    32403251        paranoid_free(file_to_archive);
     
    33323343 * however, this occurs rarely.
    33333344 */
    3334 int write_final_iso_if_necessary(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf)
     3345int write_final_iso_if_necessary(struct s_bkpinfo *bkpinfo)
    33353346{
    33363347    /*@ int ***************************************************** */
     
    33553366#endif
    33563367    paranoid_free(tmp);
    3357     res = write_iso_and_go_on(bkpinfo, mrconf, TRUE);
     3368    res = write_iso_and_go_on(bkpinfo, TRUE);
    33583369#ifndef _XWIN
    33593370    if (!g_text_mode) {
     
    33833394 * @see make_iso_fs
    33843395 */
    3385 int write_iso_and_go_on(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, bool last_cd)
     3396int write_iso_and_go_on(struct s_bkpinfo *bkpinfo, bool last_cd)
    33863397{
    33873398    /*@ pointers **************************************************** */
     
    34143425    }
    34153426    log_msg(1, "OK, time to make %s #%d",
    3416             media_descriptor_string(bkpinfo->backup_media_type),
     3427            bkpinfo->backup_media_string,
    34173428            g_current_media_number);
    34183429
     
    34613472             g_current_media_number);
    34623473    for (that_one_was_ok = FALSE; !that_one_was_ok;) {
    3463         res = make_iso_fs(bkpinfo, mrconf, isofile);
     3474        res = make_iso_fs(bkpinfo, isofile);
    34643475        if (g_current_media_number == 1 && !res
    34653476            && (bkpinfo->backup_media_type == cdr
     
    34783489            log_to_screen
    34793490                ("Please reboot from the 1st %s in Compare Mode, as a precaution.",
    3480                  media_descriptor_string(g_backup_media_type));
     3491                 g_backup_media_string);
    34813492            chdir("/");
    34823493            iamhere("Before calling verify_cd_image()");
     
    34883499        } else {
    34893500            asprintf(&tmp, "Failed to burn %s #%d. Retry?",
    3490                      media_descriptor_string(bkpinfo->backup_media_type),
     3501                     bkpinfo->backup_media_string,
    34913502                     g_current_media_number);
    34923503            res = ask_me_yes_or_no(tmp);
     
    35773588        g_current_media_number = cdno;
    35783589        if (bkpinfo->backup_media_type != iso) {
    3579             bkpinfo->media_device = find_cdrom_device(FALSE));
     3590            bkpinfo->media_device = find_cdrom_device(FALSE);
    35803591        }
    35813592        chdir("/");
     
    35953606                asprintf(&tmp,
    35963607                         "Warnings/errors were reported while checking %s #%d",
    3597                          media_descriptor_string(bkpinfo->
    3598                                                  backup_media_type),
     3608                         bkpinfo->backup_media_string,
    35993609                         g_current_media_number);
    36003610                log_to_screen(tmp);
     
    37453755}
    37463756
    3747 void mrarchive_init_conf(struct s_mrconf *mrconf) {
     3757void mr_archive_init_conf(struct s_mr_conf *mr_conf) {
    37483758    char *command = NULL;
    3749     FILE *conffd = NULL;
    37503759    FILE *fin = NULL;
    3751     int n = 0;
     3760    size_t n = 0;
    37523761    char *param = NULL;
    37533762
    3754     mrconf = (struct s_mrconf *)malloc(sizeof(struct s_mrconf));
    3755     if (mrconf == NULL) {
    3756             fatal_error("Unable to malloc mrconf");
     3763    mr_conf = (struct s_mr_conf *)malloc(sizeof(struct s_mr_conf));
     3764    if (mr_conf == NULL) {
     3765            fatal_error("Unable to malloc mr_conf");
    37573766    }
    37583767    /* Default for everything int : 0 char * : NULL */
    37593768
    37603769    /* mindi conf parameters also needed in mondo */
    3761     mrconf->ia64_boot_size = 0;
     3770    mr_conf->mindi_ia64_boot_size = 0;
    37623771
    37633772    asprintf(&command, "mindi -printvar IA64_BOOT_SIZE");
     
    37663775    pclose(fin);
    37673776    paranoid_free(command);
    3768     mrconf->ia64_boot_size = atoi(param);
     3777    mr_conf->mindi_ia64_boot_size = atoi(param);
    37693778    paranoid_free(param);
    37703779
    3771     mrconf->iso_creation_cmd = NULL;
     3780    mr_conf->mondo_iso_creation_cmd = NULL;
    37723781
    37733782    /* Finds mondo conf file */
    3774     mrconf_open(MONDO_CONF_DIR"/mondo.conf");
     3783    mr_conf_open(MONDO_CONF_DIR"/mondo.conf");
    37753784
    37763785    /* mondo conf parameters needed */
    3777     mrconf->iso_creation_cmd = mrconf_sread(iso_creation_cmd);
    3778 
    3779     mrconf_close();
     3786    mr_conf->mondo_iso_creation_cmd = mr_conf_sread("mondo_iso_creation_cmd");
     3787
     3788    mr_conf_close();
     3789}
  • trunk/mondo/mondo/common/libmondo-archive.h

    r539 r783  
    1717int make_slices_and_images(struct s_bkpinfo *bkpinfo,
    1818                           char *biggielist_fname);
    19 int make_iso_fs(struct s_bkpinfo *bkpinfo, struct s_mrconf *mrconf, char *destfile);
     19int make_iso_fs(struct s_bkpinfo *bkpinfo, char *destfile);
    2020int make_afioballs_and_images(struct s_bkpinfo *bkpinfo);
    2121extern int (*move_files_to_cd) (struct s_bkpinfo *, char *, ...);
  • trunk/mondo/mondo/common/libmondo-devices-EXT.h

    r171 r783  
    3333                                                           *, bool);
    3434
    35 
    36 extern void make_fifo(char *store_name_here, char *stub);
    37 
    38 
    3935extern void insist_on_this_cd_number(struct s_bkpinfo *bkpinfo,
    4036                                     int cd_number_i_want);
     
    6965
    7066extern char *which_partition_format(const char *drive);
     67extern char *bkptype_to_string(t_bkptype bt);
  • trunk/mondo/mondo/common/libmondo-devices.c

    r729 r783  
    6363    if (bkpinfo->media_device != NULL) {
    6464        paranoid_alloc(g_cdrom_drive_is_here, bkpinfo->media_device);   // just in case
    65     }
    66     if (bkpinfo->media_device != NULL) {
    6765        paranoid_alloc(g_dvd_drive_is_here, bkpinfo->media_device); // just in case
    6866    }
     
    9593    log_it("rctada: Unmounting all CD drives", __LINE__);
    9694    run_program_and_log_output("umount /dev/cdr* /dev/dvd*", 5);
     95}
     96
     97
     98/**
     99 * Mount the CD-ROM at @p mountpoint.
     100 * @param device The device (or file if g_ISO_restore_mode) to mount.
     101 * @param mountpoint The place to mount it.
     102 * @return TRUE for success, FALSE for failure.
     103 */
     104bool mount_CDROM_here(char *device, char *mountpoint)
     105{
     106    /*@ buffer ****************************************************** */
     107    char *command = NULL;
     108    int retval = 0;
     109
     110    assert_string_is_neither_NULL_nor_zerolength(device);
     111    assert_string_is_neither_NULL_nor_zerolength(mountpoint);
     112
     113    make_hole_for_dir(mountpoint);
     114    if (isdigit(device[0])) {
     115        paranoid_free(device);
     116        device = find_cdrom_device(FALSE);
     117    }
     118    if (g_ISO_restore_mode) {
     119
     120#ifdef __FreeBSD__
     121        char *dev = NULL;
     122
     123        dev = make_vn(device));
     124        if (!dev) {
     125            asprintf(&command, "Unable to mount ISO (make_vn(%s) failed)",
     126                    device);
     127            fatal_error(command);
     128        }
     129        paranoid_free(device);
     130        device = dev;
     131#endif
     132    }
     133
     134    log_msg(4, "(mount_CDROM_here --- device=%s, mountpoint=%s", device,
     135            mountpoint);
     136    /*@ end vars *************************************************** */
     137
     138#ifdef __FreeBSD__
     139    asprintf(&command, "mount_cd9660 -r %s %s 2>> %s",
     140            device, mountpoint, MONDO_LOGFILE);
     141#else
     142    asprintf(&command, "mount %s -o ro,loop -t iso9660 %s 2>> %s",
     143            device, mountpoint, MONDO_LOGFILE);
     144#endif
     145
     146    log_msg(4, command);
     147    if (strncmp(device, "/dev/", 5) == 0) {
     148        retract_CD_tray_and_defeat_autorun();
     149    }
     150    retval = system(command);
     151    log_msg(1, "system(%s) returned %d", command, retval);
     152    paranoid_free(command);
     153
     154    if (retval == 0) {
     155        return(TRUE);
     156    } else {
     157        return(FALSE);
     158    }
    97159}
    98160
     
    12321294
    12331295/**
    1234  * Mount the CD-ROM at @p mountpoint.
    1235  * @param device The device (or file if g_ISO_restore_mode) to mount.
    1236  * @param mountpoint The place to mount it.
    1237  * @return TRUE for success, FALSE for failure.
    1238  */
    1239 bool mount_CDROM_here(char *device, char *mountpoint)
    1240 {
    1241     /*@ buffer ****************************************************** */
    1242     char *command = NULL;
    1243     int retval = 0;
    1244 
    1245     assert_string_is_neither_NULL_nor_zerolength(device);
    1246     assert_string_is_neither_NULL_nor_zerolength(mountpoint);
    1247 
    1248     make_hole_for_dir(mountpoint);
    1249     if (isdigit(device[0])) {
    1250         paranoid_free(device);
    1251         device = find_cdrom_device(FALSE);
    1252     }
    1253     if (g_ISO_restore_mode) {
    1254 
    1255 #ifdef __FreeBSD__
    1256         char *dev = NULL;
    1257 
    1258         dev = make_vn(device));
    1259         if (!dev) {
    1260             asprintf(&command, "Unable to mount ISO (make_vn(%s) failed)",
    1261                     device);
    1262             fatal_error(command);
    1263         }
    1264         paranoid_free(device);
    1265         device = dev;
    1266 #endif
    1267     }
    1268 
    1269     log_msg(4, "(mount_CDROM_here --- device=%s, mountpoint=%s", device,
    1270             mountpoint);
    1271     /*@ end vars *************************************************** */
    1272 
    1273 #ifdef __FreeBSD__
    1274     asprintf(&command, "mount_cd9660 -r %s %s 2>> %s",
    1275             device, mountpoint, MONDO_LOGFILE);
    1276 #else
    1277     asprintf(&command, "mount %s -o ro,loop -t iso9660 %s 2>> %s",
    1278             device, mountpoint, MONDO_LOGFILE);
    1279 #endif
    1280 
    1281     log_msg(4, command);
    1282     if (strncmp(device, "/dev/", 5) == 0) {
    1283         retract_CD_tray_and_defeat_autorun();
    1284     }
    1285     retval = system(command);
    1286     log_msg(1, "system(%s) returned %d", command, retval);
    1287     paranoid_free(command);
    1288 
    1289     if (retval == 0) {
    1290         return(TRUE);
    1291     } else {
    1292         return(FALSE);
    1293     }
    1294 }
    1295 
    1296 
    1297 /**
    12981296 * Ask the user for CD number @p cd_number_i_want.
    12991297 * Sets g_current_media_number once the correct CD is inserted.
     
    13551353                        "FIXME - hacking bkpinfo->isodir from '%s' to /tmp/isodir",
    13561354                        bkpinfo->isodir);
    1357                 strcpy(bkpinfo->isodir, "/tmp/isodir");
     1355                paranoid_alloc(bkpinfo->isodir, "/tmp/isodir");
    13581356            }
    13591357        }
     
    13681366                cd_number_i_want);
    13691367        asprintf(&tmp, "Insisting on %s #%d",
    1370                 media_descriptor_string(bkpinfo->backup_media_type),
     1368                bkpinfo->backup_media_string,
    13711369                cd_number_i_want);
    13721370        asprintf(&request, "Please insert %s #%d and press Enter.",
    1373                 media_descriptor_string(bkpinfo->backup_media_type),
     1371                bkpinfo->backup_media_string,
    13741372                cd_number_i_want);
    13751373        log_msg(3, tmp);
     
    14511449        popup_and_OK(_("Please remove CD/floppy from drive(s)"));
    14521450    }
    1453     log_msg(3, "media type = %s",
    1454             bkptype_to_string(bkpinfo->backup_media_type));
     1451    bkpinfo->backup_media_string = bkptype_to_string(bkpinfo->backup_media_type);
     1452    log_msg(3, "media type = %s",bkpinfo->backup_media_string);
     1453
    14551454    if (archiving_to_media) {
    14561455        sensibly_set_tmpdir_and_scratchdir(bkpinfo);
     
    14961495            }
    14971496            asprintf(&comment, _("What speed is your %s (re)writer?"),
    1498                     media_descriptor_string(bkpinfo->backup_media_type));
     1497                    bkpinfo->backup_media_string);
    14991498            if (bkpinfo->backup_media_type == dvd) {
     1499                paranoid_free(bkpinfo->media_device);
    15001500                bkpinfo->media_device = find_dvd_device();
    15011501                asprintf(&tmp, "1");
     
    15211521            asprintf(&comment,
    15221522                    _("How much data (in Megabytes) will each %s store?"),
    1523                     media_descriptor_string(bkpinfo->backup_media_type));
     1523                    bkpinfo->backup_media_string);
    15241524
    15251525            if (!popup_and_get_string("Size", comment, sz_size)) {
     
    15511551            log_msg(1, "bkpinfo->media_device = %s",
    15521552                    bkpinfo->media_device);
     1553            tmp = find_cdrom_device(FALSE);
    15531554            if ((bkpinfo->backup_media_type == dvd)
    1554                 || ((tmp = find_cdrom_device(FALSE)) != NULL)) {
    1555                 paranoid_free(bkpinfo->media_device);
    1556                 bkpinfo->media_device = tmp;
     1555                || (tmp != NULL)) {
     1556                paranoid_alloc(bkpinfo->media_device, tmp);
    15571557                log_msg(1, "bkpinfo->media_device = %s",
    15581558                        bkpinfo->media_device);
    15591559                asprintf(&comment,
    15601560                        _("Please specify your %s drive's /dev entry"),
    1561                         media_descriptor_string(bkpinfo->
    1562                                                 backup_media_type));
     1561                        bkpinfo->backup_media_string);
    15631562                if (!popup_and_get_string
    15641563                    (_("Device?"), comment, bkpinfo->media_device)) {
     
    15681567                paranoid_free(comment);
    15691568            }
     1569            paranoid_free(tmp);
     1570
    15701571            log_msg(2, "%s device found at %s",
    1571                     media_descriptor_string(bkpinfo->backup_media_type),
     1572                    bkpinfo->backup_media_string,
    15721573                    bkpinfo->media_device);
    15731574        } else {
     
    15761577                asprintf(&tmp,
    15771578                        _("I think I've found your %s burner at SCSI node %s; am I right on the money? Say no if you have an IDE burner and you are running a 2.6 kernel. Instead, specify the IDE burner's /dev address at the next screen."),
    1578                         media_descriptor_string(bkpinfo->
    1579                                                 backup_media_type),
     1579                        bkpinfo->backup_media_string,
    15801580                        bkpinfo->media_device);
    15811581                if (!ask_me_yes_or_no(tmp)) {
     
    16281628            } else {
    16291629                if (does_file_exist("/tmp/mondo-restore.cfg")) {
     1630                    paranoid_free(bkpinfo->media_device);
    16301631                    read_cfg_var("/tmp/mondo-restore.cfg", "media-dev",
    16311632                                 bkpinfo->media_device);
     
    16391640            }
    16401641            paranoid_free(tmp);
    1641         }
    1642         if (bkpinfo->media_device == NULL) {
     1642        } else {
    16431643            if (!popup_and_get_string
    16441644                (_("Device name?"),
     
    16771677
    16781678    case nfs:
    1679         if (!bkpinfo->nfs_mount[0]) {
    1680             strcpy(bkpinfo->nfs_mount,
    1681                    call_program_and_get_last_line_of_output
    1682                    ("mount | grep \":\" | cut -d' ' -f1 | head -n1"));
     1679        if (bkpinfo->nfs_mount == NULL) {
     1680            bkpinfo->nfs_mount = call_program_and_get_last_line_of_output
     1681                   ("mount | grep \":\" | cut -d' ' -f1 | head -n1");
    16831682        }
    16841683#ifdef __FreeBSD__
     
    17041703            // check whether already mounted - we better remove
    17051704            // surrounding spaces and trailing '/' for this
     1705            /* BERLIOS: Useless
    17061706            strip_spaces(bkpinfo->nfs_mount);
     1707            */
    17071708            if (bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] == '/')
    17081709                bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] = '\0';
    17091710            asprintf(&command, "mount | grep \"%s \" | cut -d' ' -f3",
    17101711                    bkpinfo->nfs_mount);
    1711             strcpy(bkpinfo->isodir,
    1712                    call_program_and_get_last_line_of_output(command));
     1712            paranoid_free(bkpinfo->isodir);
     1713            bkpinfo->isodir = call_program_and_get_last_line_of_output(command);
    17131714            paranoid_free(command);
    17141715
     
    17381739        }
    17391740        if (!is_this_device_mounted(bkpinfo->nfs_mount)) {
    1740             sprintf(bkpinfo->isodir, "/tmp/isodir.mondo.%d",
     1741            paranoid_free(bkpinfo->isodir);
     1742            asprintf(&bkpinfo->isodir, "/tmp/isodir.mondo.%d",
    17411743                    (int) (random() % 32768));
    17421744            asprintf(&command, "mkdir -p %s", bkpinfo->isodir);
     
    17481750            run_program_and_log_output(tmp, 5);
    17491751            paranoid_free(tmp);
    1750             malloc_string(g_selfmounted_isodir);
    1751             strcpy(g_selfmounted_isodir, bkpinfo->isodir);
     1752            asprintf(&g_selfmounted_isodir, bkpinfo->isodir);
    17521753        }
    17531754        if (!is_this_device_mounted(bkpinfo->nfs_mount)) {
     
    18451846    if (archiving_to_media) {
    18461847
     1848        if (bkpinfo->boot_device) {
     1849            paranoid_free(bkpinfo->boot_device);
     1850        }
    18471851#ifdef __FreeBSD__
    18481852        bkpinfo->boot_device = call_program_and_get_last_line_of_output
    1849                ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
     1853               ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'");
    18501854#else
    18511855        bkpinfo->boot_device = call_program_and_get_last_line_of_output
    1852                ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
     1856               ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'");
    18531857#endif
    18541858        i = which_boot_loader(bkpinfo->boot_device);
     
    19891993    log_it("media device = %s", bkpinfo->media_device);
    19901994    log_it("media size = %ld", bkpinfo->media_size[1]);
    1991     log_it("media type = %s",
    1992            bkptype_to_string(bkpinfo->backup_media_type));
     1995    log_it("media type = %s", bkpinfo->backup_media_string);
     1996    paranoid_free(tmp);
    19931997    log_it("prefix = %s", bkpinfo->prefix);
    19941998    log_it("compression = %ld", bkpinfo->compression_level);
     
    19992003    log_it("boot_device = '%s' (loader=%c)", bkpinfo->boot_device,
    20002004           bkpinfo->boot_loader);
    2001     log_it("prefix = %s", bkpinfo->prefix);
    20022005    if (bkpinfo->media_size[0] < 0) {
    20032006        if (archiving_to_media) {
     
    20332036
    20342037/**
    2035  * Create a randomly-named FIFO. The format is @p stub "." [random] [random] where
    2036  * [random] is a random number between 1 and 32767.
    2037  * @param store_name_here Where to store the new filename.
    2038  * @param stub A random number will be appended to this to make the FIFO's name.
    2039  * @ingroup deviceGroup
    2040  */
    2041 void make_fifo(char *store_name_here, char *stub)
    2042 {
    2043     char *tmp;
    2044 
    2045     assert_string_is_neither_NULL_nor_zerolength(stub);
    2046 
    2047     sprintf(store_name_here, "%s%d%d", stub, (int) (random() % 32768),
    2048             (int) (random() % 32768));
    2049     make_hole_for_file(store_name_here);
    2050     mkfifo(store_name_here, S_IRWXU | S_IRWXG);
    2051     asprintf(&tmp, "chmod 770 %s", store_name_here);
    2052     paranoid_system(tmp);
    2053     paranoid_free(tmp);
    2054 }
    2055 
    2056 
    2057 /**
    20582038 * Set the tmpdir and scratchdir to reside on the partition with the most free space.
    20592039 * Automatically excludes DOS, NTFS, SMB, and NFS filesystems.
     
    20872067    }
    20882068    i = (int) (random() % 32768);
     2069    paranoid_free(bkpinfo->tmpdir);
    20892070    asprintf(&bkpinfo->tmpdir, "%s/mondo.tmp.%d", tmp, i);
    20902071    log_it("bkpinfo->tmpdir is being set to %s", bkpinfo->tmpdir);
    20912072
     2073    paranoid_free(bkpinfo->scratchdir);
    20922074    asprintf(&bkpinfo->scratchdir, "%s/mondo.scratch.%d", tmp, i);
    20932075    log_it("bkpinfo->scratchdir is being set to %s", bkpinfo->scratchdir);
     
    22772259
    22782260char which_boot_loader(char *which_device)
     2261        /* which_device is allocated here and needs to be freed by caller */
    22792262{
    22802263    /*@ buffer ***************************************************** */
     
    23152298        if (does_string_exist_in_boot_block(current_drive, "GRUB")) {
    23162299            count_grubs++;
    2317             strcpy(which_device, current_drive);
     2300            paranoid_alloc(which_device,current_drive);
    23182301            break;
    23192302        }
    23202303        if (does_string_exist_in_boot_block(current_drive, "LILO")) {
    23212304            count_lilos++;
    2322             strcpy(which_device, current_drive);
     2305            paranoid_alloc(which_device,current_drive);
    23232306            break;
    23242307        }
    23252308    }
    2326     paranoid_free(current_drive);
    23272309
    23282310    if (pclose(pdrives)) {
  • trunk/mondo/mondo/common/libmondo-devices.h

    r171 r783  
    77int does_partition_exist(const char *drive, int partno);
    88bool does_string_exist_in_boot_block(char *dev, char *str);
    9 int find_and_mount_actual_cd(struct s_bkpinfo *bkpinfo, char *mountpoint);
     9bool find_and_mount_actual_cd(struct s_bkpinfo *bkpinfo, char *mountpoint);
    1010char *find_cdrom_device(bool try_to_mount);
    1111char *find_dvd_device(void);
     
    2828
    2929
    30 
    31 void make_fifo(char *store_name_here, char *stub);
    3230
    3331void insist_on_this_cd_number(struct s_bkpinfo *bkpinfo,
     
    5856
    5957char *which_partition_format(const char *drive);
     58char *bkptype_to_string(t_bkptype bt);
  • trunk/mondo/mondo/common/libmondo-filelist.c

    r729 r783  
    266266            i = 0;
    267267        }
    268         /* BERLIOS: Useless with getline
    269            if (i > MAX_STR_LEN - 1) {
    270            incoming[MAX_STR_LEN - 30] = '\0';
    271            log_msg(1, "Warning - truncating file %s's name", incoming);
    272            err++;
    273            }
    274          */
    275268        if (incoming[i] < 32) {
    276269            incoming[i] = '\0';
     
    717710{
    718711    /*@ buffers ***************************************************** */
    719     char val_sz[MAX_STR_LEN];
    720     char *cfg_fname;
     712    char *val_sz = NULL;
     713    char *cfg_fname = NULL;
    721714
    722715    /*@ long ******************************************************** */
    723     int val_i;
     716    int val_i = 0;
    724717
    725718    /*@ end vars **************************************************** */
     
    730723    read_cfg_var(cfg_fname, "last-filelist-number", val_sz);
    731724    val_i = atoi(val_sz);
     725    paranoid_free(val_sz);
     726
    732727    if (val_i <= 0) {
    733728        val_i = 500;
     
    13561351        asprintf(&tmp,
    13571352                "find %s -maxdepth %d -fstype mvfs -prune -o -path /proc -prune -o -path /sys -prune -o -path /dev/shm -prune -o -path /media/floppy -prune -o -type d -a -print > %s 2> /dev/null",
    1358                  dir, MAX_SKEL_DEPTH, g_skeleton_filelist);
     1353                 dir, MAX_SKEL_DEPTH, skeleton_filelist);
    13591354#else
    13601355        // On BSD, for example, /sys is the kernel sources -- don't exclude
    13611356        asprintf(&tmp,
    13621357                "find %s -maxdepth %d -fstype mvfs -prune -o -path /proc -prune -o -type d -a -print > %s 2> /dev/null",
    1363                  dir, MAX_SKEL_DEPTH, g_skeleton_filelist);
     1358                 dir, MAX_SKEL_DEPTH, skeleton_filelist);
    13641359#endif
    13651360        system(tmp);
     
    14351430            /* BERLIOS: Old code
    14361431               new_with_spaces[0] = ' ';
    1437                strcpy(new_with_spaces + 1, new);
    1438                strcat(new_with_spaces, " ");
     1432               str-cpy(new_with_spaces + 1, new);
     1433               str-cat(new_with_spaces, " ");
    14391434             */
    14401435            if (strstr(skip_these, new_with_spaces)) {
     
    15041499{
    15051500    static char sz_res[MAX_STR_LEN];
    1506     char *p;
     1501    char *p = NULL;
    15071502    bool in_quotes = FALSE;
    15081503
  • trunk/mondo/mondo/common/libmondo-files-EXT.h

    r687 r783  
    77extern unsigned int updcrcr(unsigned int crc, unsigned int c);
    88extern char *calc_checksum_of_file(char *filename);
    9 extern char *calc_file_ugly_minichecksum(char *curr_fname);
    109extern long count_lines_in_file(char *filename);
    1110extern bool does_file_exist(char *filename);
  • trunk/mondo/mondo/common/libmondo-files.c

    r764 r783  
    2525
    2626extern int g_currentY;
     27extern int g_noof_log_lines;
    2728extern char *g_mondo_home;
    2829
     
    7778    }
    7879    return (output);
    79 }
    80 
    81 
    82 /**
    83  * Get a not-quite-unique representation of some of the file's @c stat properties.
    84  * The returned string has the form <tt>size-mtime-ctime</tt>.
    85  * @param curr_fname The file to generate the "checksum" for.
    86  * @return The "checksum".
    87  * @note The returned string points to static storage that will be overwritten with each call.
    88  */
    89 char *calc_file_ugly_minichecksum(char *curr_fname)
    90 {
    91 
    92     /*@ buffers ***************************************************** */
    93     char *curr_cksum;
    94 
    95     /*@ pointers **************************************************** */
    96 
    97     /*@ structures ************************************************** */
    98     struct stat buf;
    99 
    100     /*@************************************************************** */
    101 
    102     assert_string_is_neither_NULL_nor_zerolength(curr_fname);
    103     if (lstat(curr_fname, &buf)) {
    104         asprintf(&curr_cksum, "");
    105     } else {
    106         asprintf(&curr_cksum, "%ld-%ld-%ld", (long) (buf.st_size),
    107             (long) (buf.st_mtime), (long) (buf.st_ctime));
    108     }
    109     return (curr_cksum);
    11080}
    11181
     
    275245    if (kernel == NULL) {
    276246        kernel = call_program_and_get_last_line_of_output
    277                ("mindi --findkernel 2> /dev/null"));
     247               ("mindi --findkernel 2> /dev/null");
    278248    }
    279249    // If we didn't get anything back, check whether mindi raised a fatal error
     
    481451        log_it(tmp);
    482452        paranoid_free(tmp);
    483         asprintf(&output, "");
    484 
    485         return (output);
     453        return (NULL);
    486454    }
    487455    asprintf(&command, "tail -n1 %s", filename);
     
    10331001    paranoid_free(command);
    10341002
    1035     if (bkpinfo->postnuke_tarball[0]) {
     1003    if (bkpinfo->postnuke_tarball) {
    10361004        asprintf(&command, "cp -f %s %s/post-nuke.tgz",
    10371005                bkpinfo->postnuke_tarball, bkpinfo->tmpdir);
     
    11871155{
    11881156    /*@ buffers *************** */
    1189     char *tmp;
     1157    char *tmp = NULL;
    11901158
    11911159    /*@ long long ************* */
     
    12141182        asprintf(&tmp,
    12151183                _("Your backup will probably occupy a single %s. Maybe two."),
    1216                 media_descriptor_string(bkpinfo->backup_media_type));
     1184                bkpinfo->backup_media_string);
    12171185    } else {
    12181186        asprintf(&tmp, _("Your backup will occupy approximately %s media."),
    12191187                number_to_text((int) (scratchLL + 1)));
    12201188    }
    1221     if (!bkpinfo->image_devs[0] && (scratchLL < 50)) {
     1189    if (!bkpinfo->image_devs && (scratchLL < 50)) {
    12221190        log_to_screen(tmp);
    12231191    }
     
    12351203bool is_this_file_compressed(char *filename)
    12361204{
    1237     char *do_not_compress_these;
    1238     char *tmp;
    1239     char *p;
     1205    char *do_not_compress_these = NULL;
     1206    char *tmp = NULL;
     1207    char *p = NULL;
    12401208
    12411209    asprintf(&tmp, "%s/do-not-compress-these", g_mondo_home);
  • trunk/mondo/mondo/common/libmondo-files.h

    r687 r783  
    99unsigned int updcrcr(unsigned int crc, unsigned int c);
    1010char *calc_checksum_of_file(char *filename);
    11 char *calc_file_ugly_minichecksum(char *curr_fname);
    12 char *calc_file_ugly_minichecksum(char *curr_fname);
    1311long count_lines_in_file(char *filename);
    1412bool does_file_exist(char *filename);
  • trunk/mondo/mondo/common/libmondo-fork.c

    r689 r783  
    1111#include "libmondo-tools-EXT.h"
    1212
    13 extern char *g_tmpfs_mountpt;
    14 extern t_bkptype g_backup_media_type;
    1513extern bool g_text_mode;
    1614pid_t g_buffer_pid = 0;
     
    107105    log_msg(4, "Calling open_evalcall_form() with what_i_am_doing='%s'",
    108106            what_i_am_doing);
    109     strcpy(tmp, command);
    110107    if (bkpinfo->manual_cd_tray) {
    111         p = strstr(tmp, "2>>");
     108        /* Find everything after a 2>> and remove it */
     109        p = strstr(command, "2>>");
    112110        if (p) {
    113             sprintf(p, "   ");
    114             while (*p == ' ') {
    115                 p++;
    116             }
    117             for (; *p != ' '; p++) {
     111            for (; *p != ' ' && *p != '\0'; p++) {
    118112                *p = ' ';
    119113            }
    120114        }
    121         paranoid_free(command);
    122         asprintf(&command, tmp);
    123115#ifndef _XWIN
    124116        if (!g_text_mode) {
     
    164156{
    165157    /*@ buffer ****************************************************** */
    166     char *callstr;
     158    char *callstr = NULL;
    167159    char *incoming = NULL;
    168     char tmp[MAX_STR_LEN * 2];
    169160
    170161    /*@ int ********************************************************* */
    171     int res;
    172     int i;
     162    int res = 0;
    173163    size_t n = 0;
    174     int len;
    175164    bool log_if_failure = FALSE;
    176165    bool log_if_success = FALSE;
     
    203192
    204193
    205     len = (int) strlen(program);
    206     for (i = 0; i < 35 - len / 2; i++) {
    207         tmp[i] = '-';
    208     }
    209     tmp[i] = '\0';
    210     strcat(tmp, " ");
    211     strcat(tmp, program);
    212     strcat(tmp, " ");
    213     for (i = 0; i < 35 - len / 2; i++) {
    214         strcat(tmp, "-");
    215     }
    216194    res = system(callstr);
    217195    if (((res == 0) && log_if_success) || ((res != 0) && log_if_failure)) {
     
    361339// if dir=='w' then copy from orig to archived
    362340// if dir=='r' then copy from archived to orig
    363     char *tmp;
    364     char *buf;
     341    char *tmp = NULL;
     342    char *buf = NULL;
    365343    long int bytes_to_be_read, bytes_read_in, bytes_written_out =
    366344        0, bufcap, subsliceno = 0;
    367345    int retval = 0;
    368     FILE *fin;
    369     FILE *fout;
    370     FILE *ftmp;
     346    FILE *fin = NULL;
     347    FILE *fout = NULL;
     348    FILE *ftmp = NULL;
    371349
    372350    log_msg(5, "Opening.");
     
    439417            }
    440418            bytes_written_out += fwrite(buf, 1, bytes_read_in, fout);
    441             if (fread(tmp, 1, 64, fin) != 64) {
     419            if (fread(tmp, 1, 64L, fin) != 64L) {
    442420                fatal_error("Cannot read post-thingy block");
    443421            }
     
    448426            log_msg(7, "Subslice #%ld read OK", subsliceno);
    449427            subsliceno++;
    450             if (fread(tmp, 1, 64, fin) != 64) {
     428            if (fread(tmp, 1, 64L, fin) != 64L) {
    451429                fatal_error("Cannot read introductory block");
    452430            }
     
    458436
    459437    if (direction == 'w') {
     438        paranoid_free(tmp);
    460439        asprintf(&tmp, "%-64s", PIMP_END_SZ);
    461         if (fwrite(tmp, 1, 64, fout) != 64) {
     440        if (fwrite(tmp, 1, 64L, fout) != 64L) {
    462441            fatal_error("Can't write the final block");
    463442        }
     
    466445        log_msg(1, "tmpA is %s", tmp);
    467446        if (!strstr(tmp, PIMP_END_SZ)) {
    468             if (fread(tmp, 1, 64, fin) != 64) {
     447            if (fread(tmp, 1, 64L, fin) != 64L) {
    469448                fatal_error("Can't read the final block");
    470449            }
     
    472451            if (!strstr(tmp, PIMP_END_SZ)) {
    473452                ftmp = fopen("/tmp/out.leftover", "w");
    474                 bytes_read_in = fread(tmp, 1, 64, fin);
     453                bytes_read_in = fread(tmp, 1, 64L, fin);
    475454                log_msg(1, "bytes_read_in = %ld", bytes_read_in);
    476455//      if (bytes_read_in!=128+64) { fatal_error("Can't read the terminating block"); }
    477456                fwrite(tmp, 1, bytes_read_in, ftmp);
     457               
    478458                paranoid_free(tmp);
    479                
    480459                if (!(tmp = malloc(512))) {
    481460                    fatal_error("Failed to malloc() tmp");
    482461                }
    483462                /* BERLIOS : strange ???
    484                 sprintf(tmp, "I am here - %llu", ftello(fin));
    485       log_msg(0, tmp);
    486 */
     463                s-printf(tmp, "I am here - %llu", ftello(fin));
     464                log_msg(0, tmp);
     465                */
    487466                fread(tmp, 1, 512, fin);
    488467                log_msg(0, "tmp = '%s'", tmp);
     
    571550        if (pcno <= 5 && last_pcno > 40) {
    572551            close_evalcall_form();
    573             open_evalcall_form("_(Verifying..."));
     552            open_evalcall_form("_(Verifying...");
    574553        }
    575554        last_pcno = pcno;
  • trunk/mondo/mondo/common/libmondo-mountlist.c

    r688 r783  
    6363    char *tmp1 = NULL;
    6464    char *device = NULL;
     65    char *ndevice = NULL;
    6566    // BERLIOS : useless ? char *mountpoint;
    6667
     
    203204        npos = 0;
    204205        for (cur_sp_no = 'a'; cur_sp_no <= 'h'; cur_sp_no++) {
    205             sprintf(device, "%ss%i%c", device, curr_part_no, cur_sp_no);
    206             if (find_device_in_mountlist(mountlist, device) >= 0)
     206            asprintf(&ndevice, "%ss%d%c", device, curr_part_no, cur_sp_no);
     207            if (find_device_in_mountlist(mountlist, ndevice) >= 0)
    207208                npos++;
     209            paranoid_free(ndevice);
    208210        }
    209211        paranoid_free(device);
     
    500502
    501503    /*@ buffers ******************************************************** */
    502     char *tmp;
    503     char *device;
     504    char *tmp = NULL;
     505    char *tmp1 = NULL;
     506    char *device = NULL;
    504507
    505508    /*@ long *********************************************************** */
    506     long physical_drive_size = 0;
    507     long amount_allocated = 0;
     509    long physical_drive_size = 0L;
     510    long amount_allocated = 0L;
    508511
    509512    /*@ pointers ******************************************************* */
    510     char *part_table_fmt;
     513    char *part_table_fmt = NULL;
    511514
    512515    /*@ initialize ***************************************************** */
     
    559562            continue;
    560563        }
    561         // BERLIOS : useless ? strcpy(mountpoint, mountlist->el[pos].mountpoint);
     564        // BERLIOS : useless ? str-cpy(mountpoint, mountlist->el[pos].mountpoint);
    562565        /* gap in the partition list? */
    563566        if (curr_part_no - prev_part_no > 1) {
     
    751754    drivelist = malloc(sizeof(struct list_of_disks));
    752755    assert(mountlist != NULL);
    753     assert(flaws_str_A != NULL);
    754     assert(flaws_str_B != NULL);
    755     assert(flaws_str_C != NULL);
    756756
    757757    asprintf(&flaws_str, " ");
  • trunk/mondo/mondo/common/libmondo-msg.c

    r537 r783  
    1414 * The default maximum level to log messages at or below.
    1515 */
    16 int g_loglevel = DEFAULT_DEBUG_LEVEL;
     16extern int g_loglevel;
    1717
    1818/**
  • trunk/mondo/mondo/common/libmondo-raid.c

    r689 r783  
    99
    1010#include "my-stuff.h"
     11#include "mr_string.h"
    1112#include "mondostructures.h"
    1213#include "newt-specific-EXT.h"
     
    177178{
    178179    /*@ buffers ***************************************************** */
    179     char *sz_value;
     180    char *sz_value = NULL;
     181    char *sz_label = NULL;
    180182
    181183    assert(raidrec != NULL);
     
    183185
    184186    asprintf(&sz_value, "%d", value);
    185     strcpy(raidrec->additional_vars.el[lino].label, label);
    186     strcpy(raidrec->additional_vars.el[lino].value, sz_value);
    187     paranoid_free(sz_value);
     187    asprintf(&sz_label,label);
     188    raidrec->additional_vars.el[lino].value = sz_value;
     189    raidrec->additional_vars.el[lino].label = sz_label;
    188190}
    189191#endif
     
    956958    // trim leading spaces
    957959    pos = string;
    958     while (*pos == ' ') pos += 1;
     960    while (*pos == ' ') pos++;
    959961    asprintf(&strtmp, pos);
    960     strcpy(string, strtmp);
     962    paranoid_alloc(string,strtmp);
    961963    paranoid_free(strtmp);
    962964    // if we have newline after only spaces, this is a blank line, update
     
    979981    // get RAID device name
    980982    asprintf(&strtmp,"%s%s", device_prefix, token);
    981     strcpy(raidlist->el[raidlist->entries].raid_device, strtmp);
    982     paranoid_free(strtmp);
     983    raidlist->el[raidlist->entries].raid_device = strtmp;
    983984    paranoid_free(token);
    984985    // skip ':' and status
  • trunk/mondo/mondo/common/libmondo-stream.c

    r689 r783  
    543543
    544544
    545 /**
    546  * FIFO used to read/write to the tape device.
    547  * @bug This seems obsolete now that we call an external @c buffer program. Please look onto this.
    548  */
    549 char g_tape_fifo[MAX_STR_LEN];
    550 
    551545int set_tape_block_size_with_mt(char *tapedev,
    552546                                long internal_tape_block_size)
     
    622616         open_device_via_buffer(bkpinfo->media_device, 'r',
    623617                                bkpinfo->internal_tape_block_size))) {
    624         log_OS_error(g_tape_fifo);
    625618        log_to_screen(_("Cannot openin stream device"));
    626619        return (1);
     
    748741        (g_tape_stream =
    749742         open_device_via_buffer(tapedev, 'w', internal_tape_block_size))) {
    750         log_OS_error(g_tape_fifo);
    751743        log_to_screen(_("Cannot openin stream device"));
    752744        return (1);
     
    12491241         open_device_via_buffer(bkpinfo->media_device, 'r',
    12501242                                bkpinfo->internal_tape_block_size))) {
    1251         log_OS_error(g_tape_fifo);
    12521243        log_to_screen(_("Cannot openin stream device"));
    12531244        return (1);
     
    13091300             open_device_via_buffer(bkpinfo->media_device, 'w',
    13101301                                    bkpinfo->internal_tape_block_size))) {
    1311             log_OS_error(g_tape_fifo);
    13121302            log_to_screen(_("Cannot openin stream device"));
    13131303            return (1);
  • trunk/mondo/mondo/common/libmondo-string-EXT.h

    r588 r783  
    33 */
    44
    5 extern char *build_partition_name(char *partition, const char *drive,
    6                                   int partno);
     5extern char *build_partition_name(const char *drive, int partno);
    76extern void center_string(char *in_out, int width);
    87extern char *commarize(char *);
     
    4443extern inline void turn_wildcard_chars_into_literal_chars(char *out,
    4544                                                          char *in);
    46 /* Valid external functions */
    47 extern char *mr_strtok(char *instr, const char *delims, int *lastpos);
  • trunk/mondo/mondo/common/libmondo-string.c

    r768 r783  
    1414#include "newt-specific-EXT.h"
    1515#include "libmondo-tools-EXT.h"
     16#include <math.h>
    1617
    1718/*@unused@*/
     
    136137
    137138
    138 /*
    139  * Add commas every third place in @p input.
    140  * @param input The string to commarize.
    141  * @return The string with commas.
    142  * @note The returned string points to static storage that will be overwritten with each call.
    143  */
    144 char *commarize(char *input)
    145 {
    146     char *pos_w_commas;
    147     static char output[MAX_STR_LEN];
    148     char *tmp;
    149     int j;
    150 
    151     assert(input != NULL);
    152 
    153     asprintf(&tmp, "%s", input);
    154     if (strlen(tmp) > 6) {
    155         asprintf(&pos_w_commas, "%s", tmp);
    156         j = (int) strlen(pos_w_commas);
    157         tmp[j - 6] = ',';
    158         strcpy(tmp + j - 5, pos_w_commas + j - 6);
    159         paranoid_free(pos_w_commas);
    160         asprintf(&pos_w_commas, "%s", tmp);
    161     }
    162     if (strlen(tmp) > 3) {
    163         j = (int) strlen(tmp);
    164         asprintf(&pos_w_commas, "%s", tmp);
    165         pos_w_commas[j - 3] = ',';
    166         strcpy(pos_w_commas + j - 2, tmp + j - 3);
    167     } else {
    168         asprintf(&pos_w_commas, "%s", tmp);
    169     }
    170     strcpy(output, pos_w_commas);
    171     paranoid_free(pos_w_commas);
    172     paranoid_free(tmp);
    173     return (output);
    174 }
    175 
    176 
    177139/**
    178140 * Turn an entry from the RAID editor's disklist into a GUI-friendly string.
     
    601563
    602564    /*@ initialize ****************************************************** */
    603     assert(flaws_str_A != NULL);
    604     assert(flaws_str_B != NULL);
    605     assert(flaws_str_C != NULL);
    606565    assert(flaws_str != NULL);
    607566
    608     flaws_str_A[0] = flaws_str_B[0] = flaws_str_C[0] = '\0';
    609 
     567    flaws_str_A = NULL;
     568    flaws_str_B = NULL;
     569    flaws_str_C = NULL;
    610570
    611571    if (!res && !strlen(flaws_str)) {
     
    613573    }
    614574    if (strlen(flaws_str) > 0) {
    615         sprintf(flaws_str_A, "%s", flaws_str + 1);
     575        asprintf(&flaws_str_A, "%s", flaws_str + 1);
    616576    }
    617577    if (strlen(flaws_str_A) >= 74) {
    618578        for (i = 74; flaws_str_A[i] != ' '; i--);
    619         strcpy(flaws_str_B, flaws_str_A + i + 1);
     579        asprintf(&flaws_str_B, "%s", flaws_str_A + i + 1);
    620580        flaws_str_A[i] = '\0';
    621581    }
    622582    if (strlen(flaws_str_B) >= 74) {
    623583        for (i = 74; flaws_str_B[i] != ' '; i--);
    624         strcpy(flaws_str_C, flaws_str_B + i + 1);
     584        asprintf(&flaws_str_C, "%s", flaws_str_B + i + 1);
    625585        flaws_str_B[i] = '\0';
    626586    }
     
    834794    if (c && strncmp(c, "/part", 5) == 0) {
    835795        /* yup it's devfs, return the "disc" path */
    836         strcpy(c + 1, "disc");
     796        strncpy(c + 1, "disc", (size_t)5);
    837797        return partition;
    838798    }
     
    1027987    /*@ int *********************************************** */
    1028988    int percentage = 0;
    1029     int i;
    1030     int j;
     989    int i = 0;
     990    int j = 0;
    1031991
    1032992    /*@ buffers ******************************************* */
    1033     char *outstr;
    1034     char *tmp;
    1035     char *tmp1;
    1036     char *tmp2;
    1037     char *prepstr;
    1038     char *p;
     993    char *outstr = NULL;
     994    char *tmp1 = NULL;
     995    char *tmp2 = NULL;
     996    char *prepstr = NULL;
     997    char *p = NULL;
    1039998
    1040999    assert(bkpinfo != NULL);
    10411000
    10421001    if (bkpinfo->media_size[g_current_media_number] <= 0) {
    1043         asprintf(&tmp, "%lld", g_tape_posK);
    1044         asprintf(&outstr, _("Volume %d: %s kilobytes archived so far"),
    1045                  g_current_media_number, commarize(tmp));
    1046         paranoid_free(tmp);
     1002        asprintf(&outstr, _("Volume %d: %'lld kilobytes archived so far"),
     1003                 g_current_media_number, g_tape_posK);
    10471004
    10481005        return (outstr);
     
    10601017                   bkpinfo->media_size[g_current_media_number]);
    10611018        asprintf(&prepstr, "%s %d: [",
    1062                  media_descriptor_string(bkpinfo->backup_media_type),
     1019                 bkpinfo->backup_media_string,
    10631020                 g_current_media_number);
    10641021    }
     
    10931050    return (outstr);
    10941051}
    1095 
    1096 /**
    1097  * Get a string form of @p type_of_bkp.
    1098  * @param type_of_bkp The backup type to stringify.
    1099  * @return The stringification of @p type_of_bkp.
    1100  * @note The returned string points to static storage that will be overwritten with each call.
    1101  */
    1102 char *media_descriptor_string(t_bkptype type_of_bkp)
    1103 {
    1104     static char *type_of_backup = NULL;
    1105 
    1106     if (!type_of_backup) {
    1107         malloc_string(type_of_backup);
    1108     }
    1109 
    1110     switch (type_of_bkp) {
    1111     case dvd:
    1112         strcpy(type_of_backup, "DVD");
    1113         break;
    1114     case cdr:
    1115         strcpy(type_of_backup, "CDR");
    1116         break;
    1117     case cdrw:
    1118         strcpy(type_of_backup, "CDRW");
    1119         break;
    1120     case tape:
    1121         strcpy(type_of_backup, "tape");
    1122         break;
    1123     case cdstream:
    1124         strcpy(type_of_backup, "CDR");
    1125         break;
    1126     case udev:
    1127         strcpy(type_of_backup, "udev");
    1128         break;
    1129     case iso:
    1130         strcpy(type_of_backup, "ISO");
    1131         break;
    1132     case nfs:
    1133         strcpy(type_of_backup, "nfs");
    1134         break;
    1135     default:
    1136         strcpy(type_of_backup, "ISO");
    1137     }
    1138     return (type_of_backup);
    1139 }
  • trunk/mondo/mondo/common/libmondo-string.h

    r588 r783  
    33 */
    44
    5 char *build_partition_name(char *partition, const char *drive, int partno);
     5char *build_partition_name(const char *drive, int partno);
    66void center_string(char *in_out, int width);
    77char *commarize(char *);
     
    3434char *media_descriptor_string(t_bkptype);
    3535inline void turn_wildcard_chars_into_literal_chars(char *out, char *in);
    36 
    37 /* Valid external functions */
    38 char *mr_strtok(char *instr, const char *delims, int *lastpos);
  • trunk/mondo/mondo/common/libmondo-tools.c

    r689 r783  
    7474
    7575extern t_bkptype g_backup_media_type;
     76extern char *g_backup_media_string;
    7677
    7778extern bool am_I_in_disaster_recovery_mode(void);
     
    281282{
    282283    assert(raidrec != NULL);
    283     raidrec->raid_device[0] = '\0';
     284    raidrec->raid_device = NULL;
    284285    raidrec->raid_level = -9;
    285286    raidrec->persistent_superblock = 1;
     
    356357    char *tmp = NULL;
    357358    char *tmp1 = NULL;
    358     char call_before_iso_user[MAX_STR_LEN] = "\0";
     359    char *call_before_iso_user = NULL;
    359360    int rdsiz_MB;
    360361    char *iso_path = NULL;
     
    415416    if (avm / 1024 > rdsiz_MB * 3) {
    416417        if (run_program_and_log_output(command, 5)) {
    417             g_tmpfs_mountpt[0] = '\0';
     418            paranoid_free(g_tmpfs_mountpt);
    418419            log_it("Failed to mount tmpfs");
    419420        } else {
     
    421422        }
    422423    } else {
    423         g_tmpfs_mountpt[0] = '\0';
     424        paranoid_free(g_tmpfs_mountpt);
    424425        log_it("It doesn't seem you have enough swap to use tmpfs. Fine.");
    425426    }
     
    427428
    428429    if (bkpinfo->use_lzo) {
    429         strcpy(bkpinfo->zip_exe, "lzop");
    430         strcpy(bkpinfo->zip_suffix, "lzo");
     430        paranoid_alloc(bkpinfo->zip_exe, "lzop");
     431        paranoid_alloc(bkpinfo->zip_suffix, "lzo");
    431432    } else if (bkpinfo->compression_level != 0) {
    432         strcpy(bkpinfo->zip_exe, "bzip2");
    433         strcpy(bkpinfo->zip_suffix, "bz2");
     433        paranoid_alloc(bkpinfo->zip_exe, "bzip2");
     434        paranoid_alloc(bkpinfo->zip_suffix, "bz2");
    434435    } else {
    435         bkpinfo->zip_exe[0] = bkpinfo->zip_suffix[0] = '\0';
     436        bkpinfo->zip_exe = NULL;
     437        bkpinfo->zip_suffix = NULL;
    436438    }
    437439
     
    470472            // -m isn't supported by growisofs, BTW...
    471473        } else {
    472             sprintf(bkpinfo->call_make_iso,
     474            asprintf(&bkpinfo->call_make_iso,
    473475                    "%s %s -Z %s . 2>> _ERR_",
    474476                    mondo_mkisofs_sz, "", bkpinfo->media_device);
     
    518520
    519521        if (bkpinfo->nonbootable_backup) {
    520             asprintf(&mondo_mkisofs_sz, "%s -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL_Version -V _CD#_", mrconf->mondo_iso_creation_cmd);
     522            asprintf(&mondo_mkisofs_sz, "%s -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL_Version -V _CD#_", bkpinfo->mr_conf->mondo_iso_creation_cmd);
    521523        } else if
    522524#ifdef __FreeBSD__
     
    539541        }
    540542        if (bkpinfo->manual_cd_tray) {
    541             if (bkpinfo->call_before_iso[0] == '\0') {
    542             sprintf(bkpinfo->call_before_iso,
     543            if (bkpinfo->call_before_iso == NULL) {
     544                asprintf(&bkpinfo->call_before_iso,
    543545                        "%s -o %s/temporary.iso . 2>> _ERR_",
    544546                        mondo_mkisofs_sz, bkpinfo->tmpdir);
    545                 } else {
    546                 strncpy(call_before_iso_user, bkpinfo->call_before_iso, MAX_STR_LEN);
    547                 sprintf (bkpinfo->call_before_iso,
     547            } else {
     548                asprintf(&call_before_iso_user, bkpinfo->call_before_iso);
     549                asprintf(&bkpinfo->call_before_iso,
    548550                                    "( %s -o %s/temporary.iso . 2>> _ERR_ ; %s )",
    549551                        mondo_mkisofs_sz, bkpinfo->tmpdir, call_before_iso_user);
     552                paranoid_free(call_before_iso_user);
    550553            }
    551554            log_it("bkpinfo->call_before_iso = %s", bkpinfo->call_before_iso);
    552             sprintf(bkpinfo->call_make_iso,
     555            asprintf(&bkpinfo->call_make_iso,
    553556                    "%s %s -v %s fs=4m dev=%s speed=%d %s/temporary.iso",
    554557                    cdr_exe, (bkpinfo->please_dont_eject) ? " " : "-eject",
     
    556559                    bkpinfo->cdrw_speed, bkpinfo->tmpdir);
    557560        } else {
    558             sprintf(bkpinfo->call_make_iso,
     561            asprintf(&bkpinfo->call_make_iso,
    559562                    "%s . 2>> _ERR_ | %s %s %s fs=4m dev=%s speed=%d -",
    560563                    mondo_mkisofs_sz, cdr_exe,
     
    641644                                                          h_addr)),
    642645                         strchr(bkpinfo->nfs_mount, ':'));
    643                 strcpy(bkpinfo->nfs_mount, ip_address);
     646                paranoid_alloc(bkpinfo->nfs_mount, ip_address);
    644647                paranoid_free(ip_address);
    645648            }
     
    663666        retval++;
    664667    }
    665     if (bkpinfo->include_paths[0] == '\0') {
     668    if (bkpinfo->include_paths == NULL) {
    666669        //      fatal_error ("Why no backup path?");
    667         strcpy(bkpinfo->include_paths, "/");
     670        asprintf(&bkpinfo->include_paths, "/");
    668671    }
    669672    chmod(bkpinfo->scratchdir, 0700);
    670673    chmod(bkpinfo->tmpdir, 0700);
    671674    g_backup_media_type = bkpinfo->backup_media_type;
     675    paranoid_alloc(g_backup_media_string,bkpinfo->backup_media_string);
    672676    return (retval);
    673677}
     
    712716    g_current_media_number = 1;
    713717    bkpinfo->postnuke_tarball = NULL;
    714     bkpinfo->nfs_mount = NULL;
     718    paranoid_free(bkpinfo->nfs_mount);
    715719    return (res);
    716720}
     
    748752    paranoid_free(bkpinfo->restore_path);
    749753    bkpinfo->use_lzo = FALSE;
    750     paranoid_free(bkpinfo->do_not_compress_these);
    751754    bkpinfo->verify_data = FALSE;
    752755    bkpinfo->backup_data = FALSE;
     
    767770    bkpinfo->optimal_set_size = 0;
    768771    bkpinfo->backup_media_type = none;
     772    paranoid_free(bkpinfo->backup_media_string);
    769773    paranoid_alloc(bkpinfo->include_paths, "/");
    770774    paranoid_free(bkpinfo->exclude_paths);
     
    10431047        value = NULL;
    10441048        return (1);
    1045     } else if (strstr(value, "/dev/") && strstr(value, "t0")
     1049    /* } BERLIOS: Useless:
     1050         else if (strstr(value, "/dev/") && strstr(value, "t0")
    10461051               && !strcmp(label, "media-dev")) {
    10471052        log_msg(2, "FYI, I shan't read new value for %s - already got %s",
    10481053                label, value);
    10491054        return (0);
    1050     } else {
     1055    */ } else {
    10511056        asprintf(&command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5",
    10521057                label, config_file);
     
    11021107
    11031108    log_msg(1, "Started sub");
    1104     log_msg(4, "About to set g_boot_mountpt to \"\"");
    1105     asprintf(&g_boot_mountpt, "");
    1106     log_msg(4, "Done. Great. Seeting command to something");
     1109    log_msg(4, "Setting command to something");
    11071110    asprintf(&command,
    11081111             "grep -v \":\" /etc/fstab | grep -vx \"#.*\" | grep -w \"/boot\" | tr -s ' ' '\t' | cut -f1 | head -n1");
     
    11361139                asprintf(&tmp1, "mount %s", g_boot_mountpt);
    11371140                if (run_program_and_log_output(tmp1, 5)) {
     1141                    /* BERLIOS: Useless ???
    11381142                    paranoid_free(g_boot_mountpt);
    11391143                    asprintf(&g_boot_mountpt, " ");
     1144                    */
    11401145                    log_msg(1, "Plan B");
    11411146                    if (!run_program_and_log_output("mount /boot", 5)) {
     
    11661171
    11671172    log_msg(3, "starting");
    1168     if (g_boot_mountpt[0]) {
     1173    if (g_boot_mountpt != NULL) {
    11691174        asprintf(&tmp, "umount %s", g_boot_mountpt);
    11701175        if (run_program_and_log_output(tmp, 5)) {
  • trunk/mondo/mondo/common/libmondo-verify.c

    r688 r783  
    6363    sync();
    6464
    65 /*  sprintf (command,
     65/*  s-printf (command,
    6666       "grep \"afio: \" %s | awk '{j=substr($0,8); i=index(j,\": \");printf \"/%%s\\n\",substr(j,1,i-2);}' | sort -u | grep -v \"incheckentry.*xwait\" | grep -vx \"/afio:.*\" | grep -vx \"/dev/.*\" > %s",
    6767       stderr_fname, afio_found_changes);
     
    152152    }
    153153    asprintf(&tmp, "Verifying %s #%d's tarballs",
    154              media_descriptor_string(bkpinfo->backup_media_type),
     154             bkpinfo->backup_media_string,
    155155             g_current_media_number);
    156156    open_evalcall_form(tmp);
     
    187187 * - @c restore_path
    188188 * - @c use_lzo
    189  * - @c zip_exe
    190189 * - @c zip_suffix
    191190 * @param mtpt The mountpoint the CD/DVD/ISO is mounted on.
     
    245244    iamhere("before vsbf");
    246245    asprintf(&tmp, "Verifying %s#%d's big files",
    247              media_descriptor_string(bkpinfo->backup_media_type),
     246             bkpinfo->backup_media_string,
    248247             g_current_media_number);
    249248    open_evalcall_form(tmp);
     
    391390    /*@ long *********************************************************** */
    392391    long diffs = 0;
    393     /*  getcwd(old_pwd,MAX_STR_LEN-1); */
    394392
    395393    assert(bkpinfo != NULL);
     
    405403        && strcmp(bkpinfo->zip_suffix, "lzo")) {
    406404        log_msg(2, "OK, I'm going to start using lzop.");
    407         strcpy(bkpinfo->zip_exe, "lzop");
    408         strcpy(bkpinfo->zip_suffix, "lzo");
     405        paranoid_alloc(bkpinfo->zip_exe, "lzop");
     406        paranoid_alloc(bkpinfo->zip_suffix, "lzo");
    409407        bkpinfo->use_lzo = TRUE;
    410408    }
     
    412410        && strcmp(bkpinfo->zip_suffix, "bz2")) {
    413411        log_msg(2, "OK, I'm going to start using bzip2.");
    414         strcpy(bkpinfo->zip_exe, "bzip2");
    415         strcpy(bkpinfo->zip_suffix, "bz2");
     412        paranoid_alloc(bkpinfo->zip_exe, "bzip2");
     413        paranoid_alloc(bkpinfo->zip_suffix, "bz2");
    416414        bkpinfo->use_lzo = FALSE;
    417415    }
     
    478476
    479477    /*  chdir(old_pwd); */
    480     //  sprintf (tmp, "uniq -u %s >> %s", "/tmp/mondo-verify.err", MONDO_LOGFILE);
     478    //  s-printf (tmp, "uniq -u %s >> %s", "/tmp/mondo-verify.err", MONDO_LOGFILE);
    481479    //  paranoid_system (tmp);
    482480    //  unlink ("/tmp/mondo-verify.err");
  • trunk/mondo/mondo/common/mondostructures.h

    r561 r783  
    8888   * The label for this RAID variable.
    8989   */
    90     char label[64];
     90    char *label;
    9191
    9292  /**
    9393   * The value for this RAID variable.
    9494   */
    95     char value[64];
     95    char *value;
    9696};
    9797
     
    214214       * The name of the RAID device (e.g. /dev/md0).
    215215       */
    216     char raid_device[64];
     216    char *raid_device;
    217217
    218218      /**
     
    303303 */
    304304struct s_bkpinfo {
     305
     306  /**
     307   * Pointer to the configuration structure
     308   */
     309    struct s_mr_conf *mr_conf;
     310
    305311  /**
    306312   * The device we're backing up to.
     
    346352   * compression_level is 0.
    347353   */
    348     char zip_exe[MAX_STR_LEN / 4];
     354    char *zip_exe;
    349355
    350356  /**
     
    352358   * bz2, gzip uses gz, etc. Do not include the dot.
    353359   */
    354     char zip_suffix[MAX_STR_LEN / 4];
     360    char *zip_suffix;
    355361
    356362  /**
     
    383389
    384390  /**
    385    * A filename containing a list of extensions, one per line, to not
    386    * compress. If this is set to "", afio will still exclude a set of well-known
    387    * compressed files from compression, but biggiefiles that are compressed
    388    * will be recompressed again.
    389    */
    390     char do_not_compress_these[MAX_STR_LEN / 2];
    391 
    392   /**
    393391   * If TRUE, then we should verify a backup.
    394392   */
     
    465463
    466464  /**
     465   * The string corresponding to the media type
     466   */
     467    char *backup_media_string;
     468
     469  /**
    467470   * Whether we should use a premade filelist or generate our own.
    468471   * If TRUE, then we generate our own filelist from the directories in @p include_paths.
     
    476479   * If you do nothing, "/" will be used.
    477480   */
    478     char include_paths[MAX_STR_LEN*4];
     481    char *include_paths;
    479482
    480483  /**
     
    483486   * the scratchdir, and the tempdir are automatically excluded.
    484487   */
    485     char exclude_paths[MAX_STR_LEN*4];
     488    char *exclude_paths;
    486489
    487490  /**
     
    490493   * without overwriting the old ones. Ignored during a backup.
    491494   */
    492     char restore_path[MAX_STR_LEN];
     495    char *restore_path;
    493496
    494497  /**
     
    500503   * A command to call to make an ISO image.
    501504   */
    502     char call_make_iso[MAX_STR_LEN];
     505    char *call_make_iso;
    503506
    504507  /**
    505508   * A command to call to burn the ISO image.
    506    */
    507     char call_burn_iso[MAX_STR_LEN];
     509   * BERLIOS: Useful ???
     510   */
     511    char *call_burn_iso;
    508512
    509513  /**
     
    614618    bool expanded;
    615619};
    616 
    617 
    618 
    619 /**
    620  * A structure to wrap a FIFO device for writing to a tape/CD stream.
    621  * @bug Is this structure used (w/the move to a standalone @c buffer and all)?
    622  */
    623 struct s_wrapfifo {
    624         /**
    625      * The device we write to or read from (a FIFO).
    626      */
    627     char public_device[MAX_STR_LEN / 4];
    628 
    629         /**
    630      * The actual device that data from the FIFO should be buffered and written to.
    631      */
    632     char private_device[MAX_STR_LEN / 4];
    633 
    634         /**
    635      * A buffer for holding data read from the FIFO.
    636      */
    637     char internal_buffer_IN_fifo[MAX_STR_LEN / 4];
    638 
    639         /**
    640      * A buffer for holding data to be written to the FIFO.
    641      */
    642     char internal_buffer_OUT_fifo[MAX_STR_LEN / 4];
    643 
    644         /**
    645      * If TRUE, then we're writing directly to the tape streamer; if FALSE, we're writing to the FIFO.
    646      */
    647     bool writing_to_private_device;
    648 };
    649 
    650 
    651620
    652621/**
     
    801770};
    802771
    803 struct s_mrconf {
    804     int ia64_boot_size;
    805     char *iso_creation_cmd;
    806 };
     772struct s_mr_conf {
     773    int mindi_ia64_boot_size;
     774    char *mondo_iso_creation_cmd;
     775};
  • trunk/mondo/mondo/common/newt-specific.c

    r764 r783  
    1414
    1515#include <unistd.h>
     16#include <math.h>
    1617
    1718#include "my-stuff.h"
     
    2829//static char cvsid[] = "$Id$";
    2930
    30     extern pid_t g_mastermind_pid;
    31     extern char *g_tmpfs_mountpt;
    32     extern char *g_mondo_home;
    33 
    34     extern void set_signals(int);
     31extern pid_t g_mastermind_pid;
     32extern char *g_tmpfs_mountpt;
     33extern char *g_mondo_home;
     34
     35extern void set_signals(int);
    3536
    3637/**
     
    4142 * Whether we are currently in a nested call of fatal_error().
    4243 */
    43     bool g_exiting = FALSE;
    44 
    45     newtComponent g_timeline = NULL,    ///< The line of the progress form that shows the time elapsed/remaining
    46         g_percentline = NULL,   ///< The line of the progress form that shows the percent completed/remaining
    47         g_scale = NULL,         ///< The progress bar component in the progress form
    48         g_progressForm = NULL,  ///< The progress form component itself
    49         g_blurb1 = NULL,        ///< The component for line 1 of the blurb in the progress form
    50         g_blurb2 = NULL,        ///< The component for line 2 of the blurb in the progress form
    51         g_blurb3 = NULL,        ///< The component for line 3 (updated continuously) of the blurb in the progress form
    52         g_label = NULL;         ///< ????? @bug ?????
     44bool g_exiting = FALSE;
     45
     46newtComponent g_timeline = NULL,    ///< The line of the progress form that shows the time elapsed/remaining
     47    g_percentline = NULL,   ///< The line of the progress form that shows the percent completed/remaining
     48    g_scale = NULL,         ///< The progress bar component in the progress form
     49    g_progressForm = NULL,  ///< The progress form component itself
     50    g_blurb1 = NULL,        ///< The component for line 1 of the blurb in the progress form
     51    g_blurb2 = NULL,        ///< The component for line 2 of the blurb in the progress form
     52    g_blurb3 = NULL,        ///< The component for line 3 (updated continuously) of the blurb in the progress form
     53    g_label = NULL;         ///< ????? @bug ?????
    5354
    5455/**
    5556 * Padding above the Newt components, to overcome bugs in Newt.
    5657 */
    57     char **err_log_lines = NULL,    ///< The list of log lines to show on the screen.
    58         *g_blurb_str_1,         ///< The string for line 1 of the blurb in the progress form
    59         *g_blurb_str_2,         ///< The string for line 2 of the blurb in the progress form
    60         *g_blurb_str_3;         ///< The string for line 3 (updated continuously) of the blurb in the progress form
     58char **err_log_lines = NULL,    ///< The list of log lines to show on the screen.
     59    *g_blurb_str_1,         ///< The string for line 1 of the blurb in the progress form
     60    *g_blurb_str_2,         ///< The string for line 2 of the blurb in the progress form
     61    *g_blurb_str_3;         ///< The string for line 3 (updated continuously) of the blurb in the progress form
    6162    newtComponent g_isoform_main = NULL,    ///< The evalcall form component itself
    62         g_isoform_header = NULL,    ///< The component for the evalcall form title
    63         g_isoform_scale = NULL, ///< The progress bar component in the evalcall form
    64         g_isoform_timeline = NULL,  ///< The line of the evalcall form that shows the time elapsed/remaining
    65         g_isoform_pcline = NULL;    ///< The line of the evalcall form that shows the percent completed/remaining
    66     long g_isoform_starttime;   ///< The time (in seconds since the epoch) that the evalcall form was opened.
    67     int g_isoform_old_progress = -1;    ///< The most recent progress update of the evalcall form (percent).
    68     char *g_isoform_header_str; ///< The string for the evalcall form title.
    69     int g_mysterious_dot_counter;   ///< The counter for the twirling baton (/ | \\ - ...) on percentage less than 3
    70     int g_noof_log_lines = 6;   ///< The number of lines to show in the log at the bottom of the screen.
    71     int g_noof_rows = 25;       ///< The number of rows on the screen.
    72 
    73     int g_currentY = 3;         ///< The row to write background progress messages to. Incremented each time a message is written.
    74     extern int g_current_media_number;
     63    g_isoform_header = NULL,    ///< The component for the evalcall form title
     64    g_isoform_scale = NULL, ///< The progress bar component in the evalcall form
     65    g_isoform_timeline = NULL,  ///< The line of the evalcall form that shows the time elapsed/remaining
     66    g_isoform_pcline = NULL;    ///< The line of the evalcall form that shows the percent completed/remaining
     67long g_isoform_starttime;   ///< The time (in seconds since the epoch) that the evalcall form was opened.
     68int g_isoform_old_progress = -1;    ///< The most recent progress update of the evalcall form (percent).
     69char *g_isoform_header_str; ///< The string for the evalcall form title.
     70int g_mysterious_dot_counter;   ///< The counter for the twirling baton (/ | \\ - ...) on percentage less than 3
     71int g_noof_log_lines = 6;   ///< The number of lines to show in the log at the bottom of the screen.
     72int g_noof_rows = 25;       ///< The number of rows on the screen.
     73
     74int g_currentY = 3;         ///< The row to write background progress messages to. Incremented each time a message is written.
     75extern int g_current_media_number;
    7576    pid_t g_main_pid = 0;       ///< The PID of the main Mondo process.
    76     long g_maximum_progress = 999;  ///< The maximum amount of progress (100%) for the currently opened progress form.
    77     long g_current_progress = -999; ///< The current amount of progress (filelist #, etc.) for the currently opened progress form.
    78     long g_start_time = 0;      ///< The time (in seconds since the epoch) that the progress form was opened.
    79     bool g_text_mode = TRUE;    ///< If FALSE, use a newt interface; if TRUE, use an ugly (but more compatible) dumb terminal interface.
    80     bool g_called_by_xmondo = FALSE;    ///< @bug Unneeded w/current XMondo.
    81     char *g_erase_tmpdir_and_scratchdir;    ///< The command to run to erase the tmpdir and scratchdir at the end of Mondo.
    82     char *g_selfmounted_isodir; ///< Holds the NFS mountpoint if mounted via mondoarchive.
     77long g_maximum_progress = 999;  ///< The maximum amount of progress (100%) for the currently opened progress form.
     78long g_current_progress = -999; ///< The current amount of progress (filelist #, etc.) for the currently opened progress form.
     79long g_start_time = 0;      ///< The time (in seconds since the epoch) that the progress form was opened.
     80bool g_text_mode = TRUE;    ///< If FALSE, use a newt interface; if TRUE, use an ugly (but more compatible) dumb terminal interface.
     81bool g_called_by_xmondo = FALSE;    ///< @bug Unneeded w/current XMondo.
     82char *g_erase_tmpdir_and_scratchdir;    ///< The command to run to erase the tmpdir and scratchdir at the end of Mondo.
     83char *g_selfmounted_isodir = NULL;  ///< Holds the NFS mountpoint if mounted via mondoarchive.
    8384
    8485/* @} - end of globalGroup */
     
    8687//int g_fd_in=-1, g_fd_out=-1;
    8788
    88     void popup_and_OK(char *);
     89void popup_and_OK(char *);
    8990
    9091
     
    280281        kill_anything_like_this("ntfsclone");
    281282        sync();
    282         asprintf(&tmp, "umount %s", g_tmpfs_mountpt);
    283         chdir("/");
    284         for (i = 0; i < 10 && run_program_and_log_output(tmp, 5); i++) {
    285             log_msg(2, "Waiting for child processes to terminate");
    286             sleep(1);
    287             run_program_and_log_output(tmp, 5);
    288         }
    289         paranoid_free(tmp);
     283        if (g_tmpfs_mountpt != NULL) {
     284            asprintf(&tmp, "umount %s", g_tmpfs_mountpt);
     285            chdir("/");
     286            for (i = 0; i < 10 && run_program_and_log_output(tmp, 5); i++) {
     287                log_msg(2, "Waiting for child processes to terminate");
     288                sleep(1);
     289                run_program_and_log_output(tmp, 5);
     290            }
     291            paranoid_free(tmp);
     292        }
    290293
    291294        if (g_erase_tmpdir_and_scratchdir) {
     
    298301            asprintf(&command, "rmdir %s", g_selfmounted_isodir);
    299302            run_program_and_log_output(command, 5);
     303            paranoid_free(g_selfmounted_isodir);
    300304        }
    301305
     
    356360            asprintf(&command, "rmdir %s", g_selfmounted_isodir);
    357361            run_program_and_log_output(command, 1);
     362            paranoid_free(g_selfmounted_isodir);
    358363        }
    359364//  iamhere("foo");
     
    469474
    470475        if (err_log_lines) {
    471             paranoid_free(&err_log_lines[0]);
     476            paranoid_free(err_log_lines[0]);
    472477            for (i = 1; i < g_noof_log_lines; i++) {
    473478                err_log_lines[i - 1] = err_log_lines[i];
     
    676681
    677682        /*@ pointers ********************************************************* */
    678         char *entry_value = NULL;
     683        char **entry_value = NULL;
    679684
    680685        /*@ buffers ********************************************************** */
     
    702707            newtEntry(2, newtTextboxGetNumLines(text) + 2,
    703708                      output, 50,
    704                       &entry_value, NEWT_FLAG_RETURNEXIT
     709                      entry_value, NEWT_FLAG_RETURNEXIT
    705710            );
    706711        b_1 = newtButton(6, newtTextboxGetNumLines(text) + 4, _("  OK  "));
     
    721726            // Copy entry_value before destroying the form
    722727            // clearing potentially output before
    723             paranoid_alloc(output,entry_value);
     728            paranoid_alloc(output,*entry_value);
    724729        }
    725730        newtFormDestroy(myForm);
  • trunk/mondo/mondo/include/mr_conf.h

    r768 r783  
    3131
    3232/*initialization and closing*/
    33 int mr_conf_open(const char *filename);
    34 void mr_conf_close();
     33extern int mr_conf_open(const char *filename);
     34extern void mr_conf_close();
    3535
    3636/*read integer number after string str in the current file*/
    37 int mr_conf_iread(const char *field_name);
     37extern int mr_conf_iread(const char *field_name);
    3838
    3939/*read double/float number after string str in the current file*/
    40 double mr_conf_fread(const char *field_name);
     40extern double mr_conf_fread(const char *field_name);
    4141
    4242/*
     
    4444 * This function allocates the string which has to be freed later on
    4545*/
    46 char *mr_conf_sread(const char *field_name);
     46extern char *mr_conf_sread(const char *field_name);
    4747
    4848#endif                          /* MR_CONF_H */
  • trunk/mondo/mondo/include/mr_string.h

    r768 r783  
    2626/* functions (public methods) */
    2727
    28 char *mr_strtok(char *instr, const char *delims, int *lastpos);
     28extern char *mr_strtok(char *instr, const char *delims, int *lastpos);
    2929
    3030#endif                          /* MR_STRING_H */
  • trunk/mondo/mondo/include/my-stuff.h

    r768 r783  
    2222 * The main header file for Mondo.
    2323 */
    24 
    25 /* Required for the use of getline, ... */
    26 #define _GNU_SOURCE
    2724
    2825#include <stdio.h>
  • trunk/mondo/mondo/lib/Makefile.am

    r767 r783  
    22## Process this file with Automake to generate `Makefile.in'
    33##
    4 AM_CPPFLAGS = -DMONDO_SHARE=\"$(pkgdatadir)\"
     4AM_CPPFLAGS = -DMONDO_SHARE=\"$(pkgdatadir)\" -DMONDO_CONF_DIR=\"$(sysconfdir)\" -I${top_builddir}/mondo/include
    55
    66## libmr
    77noinst_LIBRARIES = libmr.a
    88
    9 libmr_a_SOURCES  = mr_conf.c mr_conf.h \
    10                    mr_string.c mr_string.h
     9libmr_a_SOURCES  = mr_conf.c mr_string.c
  • trunk/mondo/mondo/mondoarchive/Makefile.am

    r537 r783  
    22## Process with Automake to generate Makefile.in
    33##
    4 AM_CPPFLAGS = -DMONDO_CONF_DIR=\"$(sysconfdir)\"
     4AM_CPPFLAGS = -DMONDO_CONF_DIR=\"$(sysconfdir)\" -I${top_builddir}/mondo/include
    55
    66## Headers
     
    1010sbin_PROGRAMS        = mondoarchive
    1111mondoarchive_SOURCES = main.c mondo-cli.c
    12 mondoarchive_LDADD   = ${top_builddir}/mondo/common/libmondo.a
     12mondoarchive_LDADD   = ${top_builddir}/mondo/common/libmondo.a ${top_builddir}/mondo/lib/libmr.a
  • trunk/mondo/mondo/mondoarchive/main.c

    r688 r783  
    1717#include <stdio.h>
    1818#include <stdlib.h>
    19 #include "../common/my-stuff.h"
     19#include "my-stuff.h"
    2020#include "../common/mondostructures.h"
    2121#include "../common/libmondo.h"
     
    3333extern bool g_remount_cdrom_at_end, g_remount_floppy_at_end;
    3434extern char *g_mondo_home;
    35 extern char *g_tmpfs_mountpt;
    3635extern char *g_erase_tmpdir_and_scratchdir;
    3736extern double g_kernel_version;
     
    4140long diffs;
    4241
    43 extern t_bkptype g_backup_media_type;
    4442extern int g_loglevel;
    4543
    4644/****************** subroutines used only by main.c ******************/
    4745
     46extern void mr_archive_init_conf(struct s_mr_conf *mr_conf);
    4847
    4948/**
     
    131130{
    132131    struct s_bkpinfo *bkpinfo;
    133     struct s_mrconf *mrconf;
    134132    char *tmp;
    135133    int res = 0;
     
    147145    }
    148146
    149 /* If -V, -v or --version then echo version no. and quit */
     147    /* If -V, -v or --version then echo version no. and quit */
    150148    if (argc == 2
    151149        && (!strcmp(argv[argc - 1], "-v") || !strcmp(argv[argc - 1], "-V")
     
    155153    }
    156154
    157 /* Initialize variables */
    158 
     155    /* Initialize variables */
    159156    malloc_libmondo_global_strings();
    160 
    161     /* Initialize Configuration Structure */
    162     mrarchive_init_conf(mrconf);
    163157
    164158    res = 0;
     
    170164    }
    171165
    172 
    173 /* make sure PATH environmental variable allows access to mkfs, fdisk, etc. */
     166    /* Initialize Configuration Structure */
     167    mr_archive_init_conf(bkpinfo->mr_conf);
     168
     169
     170    /* make sure PATH environmental variable allows access to mkfs, fdisk, etc. */
    174171    asprintf(&tmp, "/sbin:/usr/sbin:%s:/usr/local/sbin", getenv("PATH"));
    175172    setenv("PATH", tmp, 1);
    176173    paranoid_free(tmp);
    177174
    178 /* Add the ARCH environment variable for ia64 purposes */
     175    /* Add the ARCH environment variable for ia64 purposes */
    179176    setenv("ARCH", get_architecture(), 1);
    180177
     
    331328    /* If we're meant to backup then backup */
    332329    if (bkpinfo->backup_data) {
    333         res = backup_data(bkpinfo, mrconf);
     330        res = backup_data(bkpinfo);
    334331        retval += res;
    335332        if (res) {
  • trunk/mondo/mondo/mondoarchive/mondo-cli.c

    r689 r783  
    77/** @def BOOT_LOADER_CHARS The characters allowed for boot loader on this platform. */
    88
    9 #include "../common/my-stuff.h"
     9#include "my-stuff.h"
    1010#include "../common/mondostructures.h"
    1111#include "mondo-cli-EXT.h"
     
    1818extern bool g_text_mode;
    1919extern bool g_skip_floppies;    ///< Whether to skip the creation of boot disks
    20 extern char g_startdir[MAX_STR_LEN];    ///< ????? @bug ?????
    21 extern char g_tmpfs_mountpt[MAX_STR_LEN];
    22 extern bool g_sigpipe;
    23 
    24 /*@ file pointer **************************************************/
    25 extern FILE *g_tape_stream;
    26 
    27 /*@ long long *****************************************************/
    28 extern long long g_tape_posK;
    29 
    30 /*@ long **********************************************************/
    31 extern long g_noof_sets;
    32 
    33 /*@ bool******** **************************************************/
    34 bool g_debugging = FALSE;       ///< ????? @bug ????? @ingroup globalGroup
    35 bool g_running_live = FALSE;    ///< ????? @bug ????? @ingroup globalGroup
    3620extern bool g_cd_recovery;
     21extern double g_kernel_version;
     22extern char *resolve_softlinks_to_get_to_actual_device_file(char *);
    3723
    3824/**
     
    4430 */
    4531bool g_ISO_restore_mode = FALSE;
    46 
    47 
    48 extern double g_kernel_version;
    49 
    50 extern int g_current_media_number;
    51 
    52 
    53 
    54 extern pid_t g_main_pid;
    55 
    56 
    57 
    58 
    59 extern char *resolve_softlinks_to_get_to_actual_device_file(char *);
    60 
    6132
    6233
     
    140111    paranoid_free(tmp);
    141112
    142     if (bkpinfo->nfs_mount[0] != '\0') {
     113    if (bkpinfo->nfs_mount != NULL) {
    143114        store_nfs_config(bkpinfo);
    144115    }
     
    303274        if (!strcmp(bkpinfo->include_paths, "/")) {
    304275            log_msg(2, "'/' is pleonastic.");
    305             bkpinfo->include_paths[0] = '\0';
    306         }
    307         if (bkpinfo->include_paths[0]) {
    308             strcat(bkpinfo->include_paths, " ");
     276            bkpinfo->include_paths = NULL;
    309277        }
    310278        asprintf(&tmp1, flag_val['I']);
     
    332300        paranoid_free(tmp1);
    333301
    334         strncpy(bkpinfo->include_paths + strlen(bkpinfo->include_paths),
    335                 flag_val['I'],
    336                 4*MAX_STR_LEN - strlen(bkpinfo->include_paths));
     302        if (bkpinfo->include_paths == NULL) {
     303            asprintf(&tmp1, "%s", flag_val['I']);
     304        } else {
     305            asprintf(&tmp1, "%s %s", bkpinfo->include_paths, flag_val['I']);
     306        }
     307        paranoid_alloc(bkpinfo->include_paths,tmp1);
     308        paranoid_free(tmp1);
     309
    337310        log_msg(1, "include_paths is now '%s'", bkpinfo->include_paths);
    338311        if (bkpinfo->include_paths[0] == '-') {
     
    348321    }
    349322
    350 
    351323    if (flag_set['J']) {
    352324        if (flag_set['I']) {
     
    356328        }
    357329        bkpinfo->make_filelist = FALSE;
    358         strcpy(bkpinfo->include_paths, flag_val['J']);
    359     }
     330        paranoid_alloc(bkpinfo->include_paths, flag_val['J']);
     331    }
     332
    360333    if (flag_set['c'] || flag_set['w'] || flag_set['C'] || flag_set['r']) {
    361334        if (!flag_set['r'] && g_kernel_version <= 2.5
     
    374347        }
    375348
    376         if (system("which cdrecord > /dev/null 2> /dev/null")
    377             && system("which dvdrecord > /dev/null 2> /dev/null")) {
    378             fatal_error
    379                 ("Please install dvdrecord/cdrecord and try again.");
    380         }
    381349        if (flag_set['C']) {
    382350            bkpinfo->cdrw_speed = atoi(flag_val['C']);
     
    408376        }
    409377    }
     378
    410379    if (flag_set['t'] && !flag_set['d']) {
    411380        log_it("Hmm! No tape drive specified. Let's see what we can do.");
     
    437406            }
    438407        }
    439         tmp = find_home_of_exe("growisofs");
    440         if (!tmp) {
    441             fatal_error
    442                 ("Please install growisofs (probably part of dvd+rw-tools). If you want DVD support, you need it.");
    443         }
    444         paranoid_free(tmp);
    445 
    446         tmp = find_home_of_exe("dvd+rw-format");
    447         if (!tmp) {
    448             fatal_error
    449                 ("Please install dvd+rw-format (probably part of dvd+rw-tools). If you want DVD support, you need it.");
    450         }
    451         paranoid_free(tmp);
    452408
    453409        if (strchr(flag_val['d'], ',')) {
     
    498454    }
    499455    if (flag_set['n']) {
    500         asprintf(&tmp, flag_val['n']);
    501         bkpinfo->nfs_mount = tmp;
     456        paranoid_alloc(bkpinfo->nfs_mount,flag_val['n']);
    502457        if (!flag_set['d']) {
    503             asprintf(&tmp, "/");
    504             bkpinfo->nfs_remote_dir = tmp;
     458            paranoid_alloc(bkpinfo->nfs_remote_dir,"/");
    505459        }
    506460        asprintf(&tmp, "mount | grep -x \"%s .*\" | cut -d' ' -f3",
    507461                bkpinfo->nfs_mount);
     462        paranoid_free(bkpinfo->isodir);
    508463        bkpinfo->isodir = call_program_and_get_last_line_of_output(tmp);
    509464        paranoid_free(tmp);
     
    516471        log_msg(3, "isodir= %s", bkpinfo->isodir);
    517472    }
     473
    518474    if (flag_set['c']) {
    519475        bkpinfo->backup_media_type = cdr;
     
    541497    }
    542498
    543 /* optional, popular */
     499    /* optional, popular */
    544500    if (flag_set['g']) {
    545501        g_text_mode = FALSE;
    546502    }
     503
    547504    if (flag_set['E']) {
    548         if (bkpinfo->exclude_paths[0]) {
    549             strcat(bkpinfo->exclude_paths, " ");
    550         }
    551505        asprintf(&tmp1, flag_val['E']);
    552506        p = tmp1;
     
    571525        paranoid_free(tmp1);
    572526
    573         strncpy(bkpinfo->exclude_paths + strlen(bkpinfo->exclude_paths),
    574                 flag_val['E'],
    575                 4*MAX_STR_LEN - strlen(bkpinfo->exclude_paths));
    576     }
     527        if (bkpinfo->exclude_paths == NULL) {
     528            asprintf(&tmp1, "%s", flag_val['E']);
     529        } else {
     530            asprintf(&tmp1, "%s %s", bkpinfo->exclude_paths, flag_val['E']);
     531        }
     532        paranoid_alloc(bkpinfo->exclude_paths,tmp1);
     533        paranoid_free(tmp1);
     534    }
     535
    577536    if (flag_set['e']) {
    578537        bkpinfo->please_dont_eject = TRUE;
    579538    }
     539
    580540    if (flag_set['N'])          // exclude NFS mounts & devices
    581541    {
    582542        psz = list_of_NFS_mounts_only();
    583         if (bkpinfo->exclude_paths[0]) {
    584             strncat(bkpinfo->exclude_paths, " ", MAX_STR_LEN);
    585         }
    586         strncat(bkpinfo->exclude_paths, psz, MAX_STR_LEN);
     543        if (bkpinfo->exclude_paths != NULL) {
     544            asprintf(&tmp1, "%s %s", bkpinfo->exclude_paths, psz);
     545        } else {
     546            asprintf(&tmp1, "%s", psz);
     547        }
    587548        paranoid_free(psz);
     549        paranoid_alloc(bkpinfo->exclude_paths, tmp1);
     550        paranoid_free(tmp1);
    588551
    589552        log_msg(3, "-N means we're now excluding %s",
    590553                bkpinfo->exclude_paths);
    591554    }
    592     if (strlen(bkpinfo->exclude_paths) >= MAX_STR_LEN) {
    593         fatal_error
    594             ("Your '-E' parameter is too long. Please use '-J'. (See manual.)");
    595     }
     555
    596556    if (flag_set['b']) {
    597557        asprintf(&psz, flag_val['b']);
     
    613573        bkpinfo->internal_tape_block_size = itbs;
    614574    }
     575
    615576    if (flag_set['D']) {
    616577        bkpinfo->differential = 1;
     
    621582        }
    622583    }
     584
    623585    if (flag_set['x']) {
    624         asprintf(&tmp, flag_val['x']);
    625         bkpinfo->image_devs = tmp;
     586        paranoid_alloc(bkpinfo->image_devs,flag_val['x']);
    626587        if (run_program_and_log_output("which ntfsclone", 2)) {
    627588            fatal_error("Please install ntfsprogs package/tarball.");
    628589        }
    629590    }
     591
    630592    if (flag_set['m']) {
    631593        bkpinfo->manual_cd_tray = TRUE;
    632594    }
     595
    633596    if (flag_set['k']) {
    634597        if (strcasecmp(flag_val['k'], "FAILSAFE")) {
    635             asprintf(&tmp, "FAILSAFE");
    636             bkpinfo->kernel_path = tmp;
     598            paranoid_alloc(bkpinfo->kernel_path,"FAILSAFE");
    637599
    638600            if (!does_file_exist(bkpinfo->kernel_path)) {
     
    645607            }
    646608        } else {
    647             asprintf(&tmp, flag_val['k']);
    648             bkpinfo->kernel_path = tmp;
    649         }
    650     }
     609            paranoid_alloc(bkpinfo->kernel_path,flag_val['k']);
     610        }
     611    }
     612
    651613    if (flag_set['p']) {
    652         asprintf(&tmp, bkpinfo->prefix);
    653         bkpinfo->prefix = tmp;
    654     }
    655 
     614        paranoid_alloc(bkpinfo->prefix,flag_val['p']);
     615    }
    656616
    657617    if (flag_set['d']) {        /* backup directory (if ISO/NFS) */
    658618        if (flag_set['i']) {
    659             asprintf(&tmp, flag_val['d']);
    660             bkpinfo->isodir = tmp;
     619            paranoid_alloc(bkpinfo->isodir,flag_val['d']);
    661620            asprintf(&tmp, "ls -l %s", bkpinfo->isodir);
    662621            if (run_program_and_log_output(tmp, FALSE)) {
     
    666625            paranoid_free(tmp);
    667626        } else if (flag_set['n']) {
    668             asprintf(&tmp, flag_val['d']);
    669             bkpinfo->nfs_remote_dir = tmp;
     627            paranoid_alloc(bkpinfo->nfs_remote_dir,flag_val['d']);
    670628        } else {                /* backup device (if tape/CD-R/CD-RW) */
    671629
     
    698656            }
    699657        } else if ((tmp = find_cdrw_device()) ==  NULL) {
    700             paranoid_free(bkpinfo->media_device);
    701             bkpinfo->media_device = tmp;
     658            paranoid_alloc(bkpinfo->media_device, tmp);
     659            paranoid_free(tmp);
    702660            retval++;
    703661            log_to_screen
     
    723681    j = (int) random() % 32768;
    724682    if (flag_set['S']) {
    725         asprintf(&tmp, "%s/mondo.scratch.%ld", flag_val['S'], j);
     683        asprintf(&tmp, "%s/mondo.scratch.%d", flag_val['S'], j);
    726684        paranoid_free(bkpinfo->scratchdir);
    727685        bkpinfo->scratchdir = tmp;
    728686    }
    729687    if (flag_set['T']) {
    730         asprintf(&tmp, "%s/mondo.tmp.%ld", flag_val['T'], j);
     688        asprintf(&tmp, "%s/mondo.tmp.%d", flag_val['T'], j);
    731689        paranoid_free(bkpinfo->tmpdir);
    732690        bkpinfo->tmpdir = tmp;
     
    750708        paranoid_free(tmp);
    751709    }
     710
    752711    if (flag_set['A']) {
    753         asprintf(&tmp, flag_val['A']);
    754         bkpinfo->call_after_iso = tmp;
     712        paranoid_alloc(bkpinfo->call_after_iso,flag_val['A']);
    755713    }
    756714    if (flag_set['B']) {
    757         asprintf(&tmp, flag_val['B']);
    758         bkpinfo->call_before_iso = tmp;
     715        paranoid_alloc(bkpinfo->call_before_iso,flag_val['B']);
    759716    }
    760717    if (flag_set['F']) {
     
    784741#undef BOOT_LOADER_CHARS
    785742    }
     743
     744    tmp = NULL;
    786745    if (flag_set['f']) {
    787746        tmp = resolve_softlinks_to_get_to_actual_device_file(flag_val['f']);
    788         bkpinfo->boot_device = tmp;
     747        paranoid_alloc(bkpinfo->boot_device,tmp);
    789748    }
    790749    if (flag_set['Q']) {
     
    796755        log_msg(3, "boot loader is %c, residing at %s", i, tmp);
    797756        printf(_("boot loader is %c, residing at %s\n"), i, tmp);
     757        paranoid_free(tmp);
    798758        finish(0);
    799759    }
     
    801761
    802762    if (flag_set['P']) {
    803         asprintf(&tmp, flag_val['P']);
    804         bkpinfo->postnuke_tarball = tmp;
    805     }
     763        paranoid_alloc(bkpinfo->postnuke_tarball,flag_val['P']);
     764    }
     765
    806766    if (flag_set['L']) {
    807767        bkpinfo->use_lzo = TRUE;
     
    821781            (_("Forcing you to use LILO. SuSE 9.0 (64-bit) has a broken mkfs.vfat binary."));
    822782    }
     783
    823784    if (flag_set['o']) {
    824785        bkpinfo->make_cd_use_lilo = TRUE;
  • trunk/mondo/mondo/mondorestore/Makefile.am

    r426 r783  
    22## Process with Automake to generate Makefile.in
    33##
     4
     5AM_CPPFLAGS = -DMONDO_CONF_DIR=\"$(sysconfdir)\" -I${top_builddir}/mondo/include
    46
    57## Headers
     
    1214mondorestore_SOURCES  = mondo-prep.c mondo-restore.c mondo-rstr-newt.c \
    1315                        mondo-rstr-compare.c mondo-rstr-tools.c
    14 mondorestore_LDADD    = ${top_builddir}/mondo/common/libmondo.a @MONDORESTORE_STATIC@
     16mondorestore_LDADD    = ${top_builddir}/mondo/common/libmondo.a ${top_builddir}/mondo/lib/libmr.a @MONDORESTORE_STATIC@
     17
     18
  • trunk/mondo/mondo/mondorestore/mondo-prep.c

    r764 r783  
    99
    1010
    11 #include "../common/my-stuff.h"
     11#include "my-stuff.h"
    1212#include "../common/mondostructures.h"
    1313#include "mondoprep.h"
     
    5353    char *command;
    5454    int lino;
    55     int i;
    5655    FILE *fout;
    5756    char *buf;
    58     const int blocksize = 512;
    5957    struct list_of_disks *drivelist = NULL;
    6058// If LVMs are present and a zero-and-reboot wasn't recently undertaken
    6159// then zero & insist on reboot.
    62     buf = malloc(blocksize);
    6360    if (does_file_exist("/tmp/i-want-my-lvm"))  // FIXME - cheating :)
    6461    {
     
    8986            log_to_screen("Please hit 'Enter' to reboot.");
    9087            for (lino = 0; lino < drivelist->entries; lino++) {
    91                 for (i = 0; i < blocksize; i++) {
    92                     buf[i] = 0;
    93                 }
    94                 sprintf(buf, "%s\n", MONDO_WAS_HERE);
     88                asprintf(&buf, "%s\n", MONDO_WAS_HERE);
    9589                fout = fopen(drivelist->el[lino].device, "w+");
    9690                if (!fout) {
     
    9892                            drivelist->el[lino].device);
    9993                } else {
    100                     if (1 != fwrite(buf, blocksize, 1, fout)) {
     94                    if (1 != fwrite(buf, strlen(buf)+1, 1, fout)) {
    10195                        log_msg(1, "Failed to wipe %s",
    10296                                drivelist->el[lino].device);
     
    107101                    fclose(fout);
    108102                }
     103                paranoid_free(buf);
    109104            }
    110105            sync();
     
    257252    for (getline(&incoming, &n1, fin); !feof(fin); getline(&incoming, &n1, fin)) {
    258253        fgetpos(fin, &orig_pos);
    259         /* BERLIOS : Strange no ? */
     254        /* we want to execute lines begining with a # */
    260255        if (incoming[0] != '#') {
    261256            continue;
     
    268263        }
    269264        if ((p = strstr(incoming, "vgcreate"))) {
    270 // include next line(s) if they end in /dev (cos we've got a broken i-want-my-lvm)
     265            // include next line(s) if they end in /dev (cos we've got a broken i-want-my-lvm)
    271266            for (getline(&tmp, &n, fin); !feof(fin); getline(&tmp, &n, fin)) {
    272267                if (tmp[0] == '#') {
     
    287282                }
    288283            }
    289             malloc_string(tmp1);
    290             strcpy(tmp1, p + strlen("vgcreate") + 1);
     284            asprintf(&tmp1, p + strlen("vgcreate") + 1);
    291285            for (q = tmp1; *q > 32; q++);
    292286            *q = '\0';
     
    294288            asprintf(&tmp, "rm -Rf /dev/%s", tmp1);
    295289            paranoid_free(tmp1);
     290
    296291            run_program_and_log_output(tmp, 1);
    297292            paranoid_free(tmp);
     
    304299        }
    305300        for (p = incoming + 1; *p == ' '; p++);
    306         paranoid_free(command);
    307         asprintf(&command, p);
     301        paranoid_alloc(command,p);
    308302        for (p = command; *p != '\0'; p++);
    309303        for (; *(p - 1) < 32; p--);
    310304        *p = '\0';
     305
     306        /* BERLIOS: we should rather define LVMv1 or v2 and use it */
    311307        res = run_program_and_log_output(command, 5);
    312308        if (res > 0 && (p = strstr(command, "lvm "))) {
     
    338334            log_msg(5, "p='%s' --> extents=%ld", p, extents);
    339335            paranoid_free(tmp);
     336
    340337            p = strstr(command, "-L");
    341338            if (!p) {
     
    349346                        *q = ' ';
    350347                    }
     348                    /* BERLIOS: Dangerous: no size control !! */
    351349                    sprintf(p, "%ld", extents);
    352350                    i = strlen(p);
     
    359357                        *(q - 1) = ' ';
    360358                    }
     359                    /* BERLIOS: Dangerous: no size control !! */
    361360                    sprintf(p, "%ld%c", extents, 'm');
    362361                    i = strlen(p);
     
    673672    char *tmp = NULL;
    674673    char *tmp1 = NULL;
     674#ifdef __FreeBSD__
    675675    char *line = NULL;
    676676    char *status = NULL;
     
    679679    size_t n = 0;
    680680    size_t n1 = 0;
     681#endif
    681682
    682683    /** end ****************************************************************/
     
    15251526            // If so, then we just call label_drive_or_slice() and return.
    15261527            char c;
     1528            char *command;
     1529
    15271530            if (current_devno == 1) {
    15281531                // try DangerouslyDedicated mode
     
    15381541                                                 drivename,
    15391542                                                 0);
    1540                     char command[MAX_STR_LEN];
    1541                     sprintf(command, "disklabel -B %s",
     1543                    asprintf(&command, "disklabel -B %s",
    15421544                            basename(drivename));
    15431545                    if (system(command)) {
     
    15461548                             ("Warning! Unable to make the drive bootable."));
    15471549                    }
     1550                    paranoid_free(command);
    15481551                    paranoid_free(device_str);
    15491552
     
    20772080        asprintf(&partcode, "8e");
    20782081    } else if (format[0] == '\0') { /* LVM physical partition */
    2079         asprintf(&partcode, "");
     2082        asprintf(&partcode, "%s", "");
    20802083    } else if (strlen(format) >= 1 && strlen(format) <= 2) {
    20812084        asprintf(&partcode, format);
     
    23752378
    23762379    assert_string_is_neither_NULL_nor_zerolength(format);
    2377     assert(program != NULL);
    23782380
    23792381    if (strcmp(format, "swap") == 0) {
    23802382#ifdef __FreeBSD__
    2381         strcpy(program, "true");
     2383        asprintf(&program, "true");
    23822384#else
    2383         strcpy(program, "mkswap");
     2385        asprintf(&program, "mkswap");
    23842386#endif
    23852387    } else if (strcmp(format, "vfat") == 0) {
    2386         strcpy(program, "format-and-kludge-vfat");
     2388        asprintf(&program, "format-and-kludge-vfat");
    23872389#ifndef __FreeBSD__
    23882390    } else if (strcmp(format, "reiserfs") == 0) {
    2389         strcpy(program, "mkreiserfs -ff");
     2391        asprintf(&program, "mkreiserfs -ff");
    23902392    } else if (strcmp(format, "xfs") == 0) {
    2391         strcpy(program, "mkfs.xfs -f -q");
     2393        asprintf(&program, "mkfs.xfs -f -q");
    23922394    } else if (strcmp(format, "jfs") == 0) {
    2393         strcpy(program, "mkfs.jfs");
     2395        asprintf(&program, "mkfs.jfs");
    23942396    } else if (strcmp(format, "ext3") == 0) {
    2395         strcpy(program, "mkfs -t ext2 -F -j -q");
     2397        asprintf(&program, "mkfs -t ext2 -F -j -q");
    23962398    } else if (strcmp(format, "minix") == 0) {
    2397         strcpy(program, "mkfs.minix");
     2399        asprintf(&program, "mkfs.minix");
    23982400#endif
    23992401    } else if (strcmp(format, "ext2") == 0) {
    2400         strcpy(program, "mke2fs -F -q");
     2402        asprintf(&program, "mke2fs -F -q");
    24012403    } else {
    24022404#ifdef __FreeBSD__
    2403         sprintf(program, "newfs_%s", format);
     2405        asprintf(&program, "newfs_%s", format);
    24042406#else
    2405         sprintf(program, "mkfs -t %s -c", format);  // -c checks for bad blocks
     2407        asprintf(&program, "mkfs -t %s -c", format);    // -c checks for bad blocks
    24062408#endif
    24072409        asprintf(&tmp, "Unknown format (%s) - assuming '%s' will do", format,
     
    25042506    }
    25052507
    2506     /*
    2507        sprintf (tmp, "cp -f %s %s.pre-resize", g_mountlist_fname, g_mountlist_fname);
    2508        run_program_and_log_output (tmp, FALSE);
    2509      */
    2510 
    25112508    current_size_of_drive = get_phys_size_of_drive(drive_name);
    25122509
     
    26002597    assert(mountlist != NULL);
    26012598
    2602     if (g_mountlist_fname[0] == '\0') {
     2599    if (g_mountlist_fname == NULL) {
    26032600        log_it
    26042601            ("resize_mountlist_prop...() - warning - mountlist fname is blank");
     
    26482645    if (c && strncmp(c, "/disc", 5) == 0) {
    26492646        /* yup its devfs, change the "disc" to "part" so the existing code works */
    2650         strcpy(c + 1, "part");
     2647        strncpy(c + 1, "part", (size_t)5);
    26512648    }
    26522649    drivemntlist->entries = 0;
  • trunk/mondo/mondo/mondorestore/mondo-restore-EXT.h

    r688 r783  
    1010extern bool g_ISO_restore_mode; /* are we in Iso Mode? */
    1111extern bool g_I_have_just_nuked;
    12 extern char *g_tmpfs_mountpt;
    1312extern char *g_isodir_device;
    1413extern char *g_isodir_format;
     
    3231                         struct raidlist_itself *);
    3332extern void sort_mountlist_by_device(struct mountlist_itself *);
    34 extern void find_pathname_of_executable_preferably_in_RESTORING(char *,
    35                                                                 char *,
    36                                                                 char *);
    3733extern int interactive_mode(struct s_bkpinfo *, struct mountlist_itself *,
    3834                            struct raidlist_itself *);
     
    5349extern int restore_a_biggiefile_from_CD(struct s_bkpinfo *, long,
    5450                                        struct s_node *);
    55 extern int restore_a_biggiefile_from_stream(struct s_bkpinfo *, char *,
    56                                             long, char *, long long,
    57                                             struct s_node *);
     51extern char *restore_a_biggiefile_from_stream(struct s_bkpinfo *, char *,
     52                                            long, struct s_node *, int);
    5853extern int restore_a_tarball_from_CD(char *, int, struct s_node *);
    5954extern int restore_a_tarball_from_stream(struct s_bkpinfo *, char *, int,
  • trunk/mondo/mondo/mondorestore/mondo-restore.c

    r689 r783  
    1313#include <unistd.h>
    1414
    15 #include "../common/my-stuff.h"
     15#include "my-stuff.h"
    1616#include "../common/mondostructures.h"
    1717#include "../common/libmondo.h"
     
    158158    assert(raidlist != NULL);
    159159    if (!bkpinfo->disaster_recovery) {
    160         strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     160        paranoid_alloc(g_mountlist_fname, "/tmp/mountlist.txt");
    161161        log_msg(2, "I guess you're testing edit_mountlist()");
    162162    }
     
    310310/**************************************************************************
    311311 *END_  EXTRACT_CONFIG_FILE_FROM_RAMDISK                                  *
    312  **************************************************************************/
    313 
    314 
    315 /**
    316  * Locate an executable in the directory structure rooted at @p restg.
    317  * @param out_path Where to put the executable.
    318  * @param fname The basename of the executable.
    319  * @param restg The directory structure to look in.
    320  * @note If it could not be found in @p restg then @p fname is put in @p out_path.
    321  * @ingroup restoreUtilityGroup
    322  */
    323 void
    324 find_pathname_of_executable_preferably_in_RESTORING(char *out_path,
    325                                                     char *fname,
    326                                                     char *restg)
    327 {
    328     assert(out_path != NULL);
    329     assert_string_is_neither_NULL_nor_zerolength(fname);
    330 
    331     sprintf(out_path, "%s/sbin/%s", restg, fname);
    332     if (does_file_exist(out_path)) {
    333         sprintf(out_path, "%s/usr/sbin/%s", restg, fname);
    334         if (does_file_exist(out_path)) {
    335             sprintf(out_path, "%s/bin/%s", restg, fname);
    336             if (does_file_exist(out_path)) {
    337                 sprintf(out_path, "%s/usr/bin/%s", restg, fname);
    338                 if (does_file_exist(out_path)) {
    339                     strcpy(out_path, fname);
    340                 }
    341             }
    342         }
    343     }
    344 }
    345 
    346 /**************************************************************************
    347  *END_FIND_PATHNAME_OF_EXECUTABLE_PREFERABLY_IN_RESTORING                 *
    348312 **************************************************************************/
    349313
     
    534498             ask_me_yes_or_no
    535499             (_("Do you want me to restore _some_ of your data?")))) {
    536         old_restpath = bkpinfo->restore_path;
     500        asprintf(&old_restpath,bkpinfo->restore_path);
    537501        for (done = FALSE; !done;) {
    538502            unlink("/tmp/filelist.full");
     
    548512                    if (!strcmp(bkpinfo->restore_path, "/")) {
    549513                        if (!ask_me_yes_or_no(_("Are you sure?"))) {
    550                             paranoid_free(bkpinfo->restore_path);
    551                             bkpinfo->restore_path = old_restpath;
     514                            paranoid_alloc(bkpinfo->restore_path, old_restpath);
    552515                            goto gotos_suck;
    553516                        }
     
    558521                    free_filelist(filelist);
    559522                } else {
    560                     bkpinfo->restore_path = old_restpath;
     523                    paranoid_alloc(bkpinfo->restore_path,old_restpath);
    561524                    free_filelist(filelist);
    562525                }
     
    569532            }
    570533        }
     534        paranoid_free(old_restpath);
    571535    } else {
    572536        mvaddstr_and_log_it(g_currentY++,
     
    630594                            ("Warning - errors occurred during the restore phase."));
    631595    }
     596    return(retval);
    632597}
    633598
     
    750715    bool boot_loader_installed = FALSE;
    751716    char *tmp = NULL;
    752     char tmpA[MAX_STR_LEN];
    753     char tmpB[MAX_STR_LEN];
    754     char tmpC[MAX_STR_LEN];
     717    char *tmpA = NULL;
     718    char *tmpB = NULL;
     719    char *tmpC = NULL;
    755720
    756721    assert(bkpinfo != NULL);
     
    807772            tmp = call_program_and_get_last_line_of_output("cat /proc/cmdline");
    808773#endif
    809             if (strstr(tmp,,"nopart")) {
     774            if (strstr(tmp,"nopart")) {
    810775                log_msg(2,
    811776                        "Not partitioning drives due to 'nopart' option.");
     
    949914    if (filelist) {
    950915        save_filelist(filelist, "/tmp/selected-files.txt");
    951         old_restpath = bkpinfo->restore_path;
     916        asprintf(&old_restpath,bkpinfo->restore_path);
    952917        if (popup_and_get_string(_("Restore path"),
    953918                                 _("Restore files to where? )"),
     
    957922        }
    958923        free_filelist(filelist);
    959         bkpinfo->restore_path = old_restpath;
     924        paranoid_alloc(bkpinfo->restore_path,old_restpath);
    960925    }
    961926    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
     
    1012977    char *bigblk = NULL;
    1013978    char *pathname_of_last_file_restored = NULL;
    1014     int retval = 0;
    1015979    int finished = FALSE;
    1016980    long sliceno;
     
    11721136            asprintf(&tmp3,
    11731137                    "Asking for %s #%d so that I may read slice #%ld\n",
    1174                     media_descriptor_string(bkpinfo->backup_media_type),
     1138                    bkpinfo->backup_media_string,
    11751139                    g_current_media_number, sliceno);
    11761140            log_msg(2, tmp3);
     
    11781142
    11791143            asprintf(&tmp3, _("Restoring from %s #%d"),
    1180                     media_descriptor_string(bkpinfo->backup_media_type),
     1144                    bkpinfo->backup_media_string,
    11811145                    g_current_media_number);
    11821146            log_to_screen(tmp3);
     
    11981162                        asprintf(&bzip2_command, "bzip2 -dc %s 2>> %s",tmp2, MONDO_LOGFILE);
    11991163                } else if (does_file_exist(tmp)) {
    1200                         asprintf(&bzip2_command, "");
     1164                        asprintf(&bzip2_command, "%s", "");
    12011165                } else {
    12021166                    log_to_screen(_("OK, that's pretty fsck0red..."));
     
    12091173            }
    12101174            asprintf(&tmp3, "Working on %s #%d, file #%ld, slice #%ld ",
    1211                     media_descriptor_string(bkpinfo->backup_media_type),
     1175                    bkpinfo->backup_media_string,
    12121176                    g_current_media_number, bigfileno + 1, sliceno);
    12131177            log_msg(2, tmp3);
     
    13001264    char *command = NULL;
    13011265    char *outfile_fname = NULL;
    1302     char *ntfsprog_command = NULL;
    13031266    char *ntfsprog_fifo = NULL;
    13041267    char *file_to_openout = NULL;
     
    14181381    }
    14191382
    1420     if (!bkpinfo->zip_exe[0]) {
     1383    if (bkpinfo->zip_exe == NULL) {
    14211384        asprintf(&command, "cat > \"%s\"", file_to_openout);
    14221385    } else {
     
    16491612                asprintf(&tmp, " -bz");
    16501613            } else {
    1651                 asprintf(&tmp, "");
     1614                asprintf(&tmp, "%s", "");
    16521615            }
    16531616            asprintf(&command,
     
    17921755            "Restoring from fileset #%ld (%ld KB) on %s #%d",
    17931756            current_tarball_number, (long) size >> 10,
    1794             media_descriptor_string(bkpinfo->backup_media_type),
     1757            bkpinfo->backup_media_string,
    17951758            g_current_media_number);
    17961759    log_msg(2, tmp);
     
    18691832        // star
    18701833        if (filelist) {
    1871             asprintf(&command, "star -x file=%s %s list=%s 2>> %s", afio_fname, executable
     1834            asprintf(&command, "star -x file=%s %s list=%s 2>> %s", afio_fname, executable,
    18721835                    filelist_subset_fname,MONDO_LOGFILE);
    18731836        } else {
     
    19461909    long noof_biggiefiles = 0L, bigfileno = 0L, total_slices = 0L;
    19471910    char *tmp = NULL;
     1911    char *tmp1 = NULL;
    19481912    bool just_changed_cds = FALSE, finished = FALSE;
    19491913    char *xattr_fname = NULL;
     
    19971961            log_msg(3, "Cannot find bigfile #%ld 's first slice on %s #%d",
    19981962                    bigfileno + 1,
    1999                     media_descriptor_string(bkpinfo->backup_media_type),
     1963                    bkpinfo->backup_media_string,
    20001964                    g_current_media_number);
    20011965            tmp1 = slice_fname(bigfileno + 1, 0, ARCHIVES_PATH, "");
     
    20121976                                         ++g_current_media_number);
    20131977                asprintf(&tmp, _("Restoring from %s #%d"),
    2014                         media_descriptor_string(bkpinfo->
    2015                                                 backup_media_type),
     1978                        bkpinfo->backup_media_string,
    20161979                        g_current_media_number);
    20171980                log_to_screen(tmp);
     
    21242087
    21252088    asprintf(&progress_str, _("Restoring from %s #%d"),
    2126             media_descriptor_string(bkpinfo->backup_media_type),
     2089            bkpinfo->backup_media_string,
    21272090            g_current_media_number);
    21282091    log_to_screen(progress_str);
     
    21742137            paranoid_free(progress_str);
    21752138            asprintf(&progress_str, _("Restoring from %s #%d"),
    2176                     media_descriptor_string(bkpinfo->backup_media_type),
     2139                    bkpinfo->backup_media_string,
    21772140                    g_current_media_number);
    21782141            log_to_screen(progress_str);
     
    21822145                    _("Restoring from fileset #%ld on %s #%d"),
    21832146                    current_tarball_number,
    2184                     media_descriptor_string(bkpinfo->backup_media_type),
     2147                    bkpinfo->backup_media_string,
    21852148                    g_current_media_number);
    21862149//    log_msg(3, "progress_str = %s", progress_str);
     
    21982161            }
    21992162            asprintf(&tmp, _("%s #%d, fileset #%ld - restore %s"),
    2200                     media_descriptor_string(bkpinfo->backup_media_type),
     2163                    bkpinfo->backup_media_string,
    22012164                    g_current_media_number, current_tarball_number,tmp1);
    22022165            paranoid_free(tmp1);
     
    22602223    char *xattr_fname = NULL;
    22612224    char *acl_fname = NULL;
    2262     char *p = NULL;
    22632225    char *pathname_of_last_biggie_restored = NULL;
    22642226    char *biggies_whose_EXATs_we_should_set = NULL; // EXtended ATtributes
    2265     long long biggie_size = NULL;
    2266     FILE *fbw = NULL;
     2227    long long biggie_size = (long long)0;
     2228    FILE *fbw;
    22672229
    22682230    assert(bkpinfo != NULL);
     
    25062468        asprintf(&progress_str, _("Restoring from fileset #%ld on %s #%d"),
    25072469                current_afioball_number,
    2508                 media_descriptor_string(bkpinfo->backup_media_type),
     2470                bkpinfo->backup_media_string,
    25092471                g_current_media_number);
    25102472        res =
     
    27352697    malloc_libmondo_global_strings();
    27362698
    2737     g_mondo_home = call_program_and_get_last_line_of_output("which mondorestore"));
    2738     sprintf(g_tmpfs_mountpt, "/tmp/tmpfs");
     2699    g_mondo_home = call_program_and_get_last_line_of_output("which mondorestore");
     2700    paranoid_alloc(g_tmpfs_mountpt, "/tmp/tmpfs");
    27392701    make_hole_for_dir(g_tmpfs_mountpt);
    27402702    g_current_media_number = 1; // precaution
     
    27462708    reset_bkpinfo(bkpinfo);
    27472709    bkpinfo->backup_media_type = none;  // in case boot disk was made for one backup type but user wants to restore from another backup type
     2710    bkpinfo->backup_media_string = NULL;
    27482711    bkpinfo->restore_data = TRUE;   // Well, yeah :-)
    27492712    if (am_I_in_disaster_recovery_mode()) {
     
    27572720
    27582721    log_msg(1, "FYI - g_mountlist_fname = %s", g_mountlist_fname);
    2759     if (strlen(g_mountlist_fname) < 3) {
    2760         fatal_error
    2761             ("Serious error in malloc()'ing. Could be a bug in your glibc.");
    2762     }
    27632722    mkdir(MNT_CDROM, 0x770);
    27642723
     
    28122771        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    28132772        if (!does_file_exist(g_mountlist_fname)) {
    2814             strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     2773            paranoid_alloc(g_mountlist_fname, "/tmp/mountlist.txt");
    28152774        }
    28162775        res = let_user_edit_the_mountlist(bkpinfo, mountlist, raidlist);
     
    28392798        bkpinfo->compression_level = 1;
    28402799        g_current_media_number = 2;
    2841         strcpy(bkpinfo->restore_path, "/tmp/TESTING");
     2800        paranoid_alloc(bkpinfo->restore_path, "/tmp/TESTING");
    28422801        bkpinfo->backup_media_type = dvd;
     2802        paranoid_free(bkpinfo->backup_media_string);
     2803        bkpinfo->backup_media_string = bkptype_to_string(bkpinfo->backup_media_type);
    28432804        open_progress_form(_("Reassembling /dev/hda1"),
    28442805                           _("Shark is a bit of a silly person."),
     
    29652926
    29662927        iamhere("About to call load_mountlist and load_raidtab");
    2967         strcpy(bkpinfo->restore_path, MNT_RESTORING);
     2928        paranoid_alloc(bkpinfo->restore_path, MNT_RESTORING);
    29682929        read_cfg_file_into_bkpinfo(g_mondo_cfg_file, bkpinfo);
    29692930        retval = load_mountlist(mountlist, g_mountlist_fname);
     
    29782939                && !is_this_device_mounted(bkpinfo->nfs_mount)) {
    29792940                log_msg(1, "Mounting nfs dir");
    2980                 sprintf(bkpinfo->isodir, "/tmp/isodir");
     2941                paranoid_alloc(bkpinfo->isodir, "/tmp/isodir");
    29812942                run_program_and_log_output("mkdir -p /tmp/isodir", 5);
    29822943                asprintf(&tmp, "mount %s -t nfs -o nolock /tmp/isodir",
     
    30002961            log_msg(0, "Partitioning only.");
    30012962            load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    3002             strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     2963            paranoid_alloc(g_mountlist_fname, "/tmp/mountlist.txt");
    30032964            load_mountlist(mountlist, g_mountlist_fname);
    30042965            res = partition_everything(mountlist);
     
    30092970            log_msg(0, "Formatting only.");
    30102971            load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    3011             strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     2972            paranoid_alloc(g_mountlist_fname, "/tmp/mountlist.txt");
    30122973            load_mountlist(mountlist, g_mountlist_fname);
    30132974            res = format_everything(mountlist, FALSE, raidlist);
     
    30182979            log_msg(0, "Stopping LVM and RAID");
    30192980            load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    3020             strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     2981            paranoid_alloc(g_mountlist_fname, "/tmp/mountlist.txt");
    30212982            load_mountlist(mountlist, g_mountlist_fname);
    30222983            res = do_my_funky_lvm_stuff(TRUE, FALSE);
  • trunk/mondo/mondo/mondorestore/mondo-restore.h

    r688 r783  
    1010int catchall_mode(struct s_bkpinfo *, struct mountlist_itself *,
    1111                  struct raidlist_itself *);
    12 void find_pathname_of_executable_preferably_in_RESTORING(char *, char *,
    13                                                          char *);
    1412int interactive_mode(struct s_bkpinfo *, struct mountlist_itself *,
    1513                     struct raidlist_itself *);
     
    2220int restore_mode(struct s_bkpinfo *, struct mountlist_itself *,
    2321                 struct raidlist_itself *);
    24 int restore_a_biggiefile_from_stream(struct s_bkpinfo *, char *, long,
    25                                      char *, long long, struct s_node *,
    26                                      int, char *);
     22char *restore_a_biggiefile_from_stream(struct s_bkpinfo *, char *, long,
     23                                     struct s_node *, int);
    2724int restore_a_tarball_from_CD(char *, long, struct s_node *);
    2825int restore_a_tarball_from_stream(struct s_bkpinfo *, char *, long,
  • trunk/mondo/mondo/mondorestore/mondo-rstr-compare.c

    r689 r783  
    44
    55
    6 #include "../common/my-stuff.h"
     6#include "my-stuff.h"
    77#include "../common/mondostructures.h"
    88#include "../common/libmondo.h"
     
    4444    char *p = NULL;
    4545    int i = 0;
    46     int n = 0;
     46    size_t n = 0;
    4747    int retval = 0;
    4848
     
    258258        }
    259259        paranoid_free(tmp);
     260
    260261        if (use_star) {
    261262            if (strcmp(compressor_exe, "bzip2")) {
     
    264265            }
    265266        } else {
    266             asprintf(&tmp, compressor_exe);
    267             sprintf(compressor_exe, "-P %s -Z", tmp);
     267            tmp = compressor_exe;
     268            asprintf(&compressor_exe, "-P %s -Z", tmp);
    268269            paranoid_free(tmp);
    269270        }
     
    299300        log_OS_error(command);
    300301    }
     302    paranoid_free(command);
     303
    301304    if (length_of_file(logfile) > 5) {
    302         sprintf(command,
     305        asprintf(&command,
    303306                "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vx \"dev/.*\" >> /tmp/changed.txt",
    304307                logfile);
    305308        system(command);
     309        paranoid_free(command);
    306310        archiver_errors = count_lines_in_file(logfile);
    307311    } else {
    308312        archiver_errors = 0;
    309313    }
    310     paranoid_free(command);
    311314
    312315    if (archiver_errors) {
     
    353356
    354357    asprintf(&progress_str, _("Comparing with %s #%d "),
    355             media_descriptor_string(bkpinfo->backup_media_type),
     358            bkpinfo->backup_media_string,
    356359            g_current_media_number);
    357360
     
    402405            paranoid_free(progress_str);
    403406            asprintf(&progress_str, _("Comparing with %s #%d "),
    404                     media_descriptor_string(bkpinfo->backup_media_type),
     407                    bkpinfo->backup_media_string,
    405408                    g_current_media_number);
    406409            log_to_screen(progress_str);
  • trunk/mondo/mondo/mondorestore/mondo-rstr-newt.c

    r764 r783  
    537537    char *personalities = NULL;
    538538    char *prompt = NULL;
    539     char *sz = NULL;
    540539    int out = 0, res = 0;
    541540
     
    544543    system
    545544        ("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null");
    546     personalities = last_line_of_file("/tmp/raid-personalities.txt"));
     545    personalities = last_line_of_file("/tmp/raid-personalities.txt");
    547546    asprintf(&prompt, _("Please enter the RAID level you want. %s"),
    548547             personalities);
     
    616615    int i = 0;
    617616    int pos = 0;
    618 
    619     /** buffers ***********************************************************/
    620     char *tmp = NULL;
    621617
    622618    assert(mountlist != NULL);
     
    858854            popup_and_OK(tmp);
    859855        } else {
     856            paranoid_free(av->el[lino].label);
     857            paranoid_free(av->el[lino].value);
    860858            memcpy((void *) &av->el[lino], (void *) &av->el[av->entries--],
    861859                   sizeof(struct raid_var_line));
     860            /* BERLIOS: New way of doing should be replaced by line below. Hope it's ok.
     861             * Will be when memory for struct is also dynamically allocated
     862            av->el[lino] = av->el[av->entries--];
     863                   */
    862864        }
    863865    }
     
    13231325                                                 device);
    13241326                if (j < 0) {
    1325                     sprintf(tmp,
     1327                    asprintf(&tmp,
    13261328                            _
    13271329                            ("/etc/raidtab does not have an entry for %s; please delete it and add it again"),
    13281330                            mountlist->el[currline].device);
    13291331                    popup_and_OK(tmp);
     1332                    paranoid_free(tmp);
    13301333                } else {
    13311334                    log_it(_("edit_raidlist_entry - calling"));
     
    14991502
    15001503    void *keylist[10];
    1501     void *curr_choice;
     1504    void *curr_choice = NULL;
    15021505
    15031506    int currline2 = 0;
     
    19711974            raidrec->additional_vars.el[lino].label, sz_out);
    19721975    if (popup_and_get_string(header, comment, sz_out)) {
    1973         strcpy(raidrec->additional_vars.el[lino].value, sz_out);
     1976        paranoid_free(raidrec->additional_vars.el[lino].value);
     1977        raidrec->additional_vars.el[lino].value = sz_out;
    19741978    }
    19751979    paranoid_free(header);
    19761980    paranoid_free(comment);
    1977     paranoid_free(sz_out);
    19781981}
    19791982#endif
     
    20152018    int currline = 0;
    20162019    int finished = FALSE;
     2020    int res = 0;
    20172021
    20182022    /** buffers **********************************************************/
     
    20252029    assert(raidlist != NULL);
    20262030
    2027     asprintf(&flaws_str_A, "xxxxxxxxx");
    2028     asprintf(&flaws_str_B, "xxxxxxxxx");
    2029     asprintf(&flaws_str_C, "xxxxxxxxx");
    20302031    if (mountlist->entries > ARBITRARY_MAXIMUM) {
    20312032        log_to_screen(_("Arbitrary limits suck, man!"));
     
    20452046            _("Format"), _("Size (MB)"));
    20462047    headerMsg = newtLabel(2, 1, tmp);
    2047     flawsLabelA = newtLabel(2, 13, flaws_str_A);
    2048     flawsLabelB = newtLabel(2, 14, flaws_str_B);
    2049     flawsLabelC = newtLabel(2, 15, flaws_str_C);
     2048    flawsLabelA = newtLabel(2, 13, "x");
     2049    flawsLabelB = newtLabel(2, 14, "x");
     2050    flawsLabelC = newtLabel(2, 15, "x");
    20502051    partitionsListbox =
    20512052        newtListbox(2, 2, 10, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
     
    20572058                          bEdit, bDelete, bReload, bCancel, bOK, NULL);
    20582059    while (!finished) {
    2059         evaluate_mountlist(mountlist, flaws_str_A, flaws_str_B,
     2060        res = evaluate_mountlist(mountlist, flaws_str_A, flaws_str_B,
    20602061                           flaws_str_C);
    20612062        newtLabelSetText(flawsLabelA, flaws_str_A);
    20622063        newtLabelSetText(flawsLabelB, flaws_str_B);
    20632064        newtLabelSetText(flawsLabelC, flaws_str_C);
     2065
     2066        paranoid_free(flaws_str_A);
     2067        paranoid_free(flaws_str_B);
     2068        paranoid_free(flaws_str_C);
     2069
    20642070        b_res = newtRunForm(myForm);
    20652071        /* BERLIOS: This needs to be re-written */
    20662072        if (b_res == bOK) {
    2067             if (!evaluate_mountlist
    2068                 (mountlist, flaws_str_A, flaws_str_B, flaws_str_C)) {
     2073            if (!res) {
    20692074                finished =
    20702075                    ask_me_yes_or_no
     
    21132118            }
    21142119        }
    2115         paranoid_free(flaws_str_A);
    2116         paranoid_free(flaws_str_B);
    2117         paranoid_free(flaws_str_C);
    21182120    }
    21192121    newtFormDestroy(myForm);
     
    24132415    raidrec = &raidlist->el[pos_in_raidlist];
    24142416    initialize_raidrec(raidrec);
    2415     strcpy(raidrec->OSSWAP(raid_device, volname),
     2417    asprintf(&raidrec->OSSWAP(raid_device, volname),
    24162418           OSSWAP(device, basename(device)));
    24172419#ifndef __FreeBSD__
     
    26472649                   (void *) &raidrec->additional_vars.el[i],
    26482650                   sizeof(struct raid_var_line));
     2651            /* BERLIOS : To be changed */
    26492652        }
    26502653        raidrec->additional_vars.entries--;
  • trunk/mondo/mondo/mondorestore/mondo-rstr-newt.h

    r688 r783  
    33**/
    44
    5 #include "../common/my-stuff.h"
     5#include "my-stuff.h"
    66#include "../common/mondostructures.h"
    77#include "../common/libmondo.h"
  • trunk/mondo/mondo/mondorestore/mondo-rstr-tools.c

    r764 r783  
    55#include <unistd.h>
    66
    7 #include "../common/my-stuff.h"
     7#include "my-stuff.h"
    88#include "../common/mondostructures.h"
    99#include "../common/libmondo.h"
     
    3939
    4040extern t_bkptype g_backup_media_type;
     41extern char *g_backup_media_string;
    4142
    4243extern int g_partition_table_locked_up;
     
    290291    assert(bkpinfo != NULL);
    291292    g_ISO_restore_mode = TRUE;
     293
     294    paranoid_free(g_isodir_device);
    292295    read_cfg_var(g_mondo_cfg_file, "iso-dev", g_isodir_device);
    293296    if (bkpinfo->disaster_recovery) {
    294297/* Patch Conor Daly 26-june-2004
    295298 * Don't let this clobber an existing bkpinfo->isodir */
    296         if (!bkpinfo->isodir[0]) {
    297             strcpy(bkpinfo->isodir, "/tmp/isodir");
     299        if (!bkpinfo->isodir) {
     300            paranoid_alloc(bkpinfo->isodir, "/tmp/isodir");
    298301        }
    299302/* End patch */
     
    344347    i = what_number_cd_is_this(bkpinfo);    /* has the side-effect of calling mount_cdrom() */
    345348    asprintf(&tmp, "%s #%d has been mounted via loopback mount",
    346             media_descriptor_string(bkpinfo->backup_media_type), i);
     349            bkpinfo->backup_media_string, i);
    347350    log_msg(1, tmp);
    348351    paranoid_free(tmp);
     
    497500{
    498501    char *mount_cmd = NULL;
    499     char *tmp = NULL;
    500502    int i, res;
    501503#ifdef __FreeBSD__
     
    519521        log_msg(2, "Mounting for NFS thingy");
    520522        log_msg(2, "isodir = %s", bkpinfo->isodir);
    521         if ((!bkpinfo->isodir[0] || !strcmp(bkpinfo->isodir, "/"))
     523        if ((!bkpinfo->isodir || !strcmp(bkpinfo->isodir, "/"))
    522524            && am_I_in_disaster_recovery_mode()) {
    523             strcpy(bkpinfo->isodir, "/tmp/isodir");
     525            paranoid_alloc(bkpinfo->isodir, "/tmp/isodir");
    524526            log_msg(1, "isodir is being set to %s", bkpinfo->isodir);
    525527        }
     
    663665        asprintf(&p2, ",user_xattr");
    664666    } else {
    665         asprintf(&p2, "");
     667        asprintf(&p2, "%s", "");
    666668    }
    667669    paranoid_free(tmp);
     
    671673        asprintf(&p3, ",acl");
    672674    } else {
    673         asprintf(&p3, "");
     675        asprintf(&p3, "%s", "");
    674676    }
    675677    paranoid_free(tmp);
     
    789791    char *value = NULL;
    790792    char *tmp = NULL;
     793    char *tmp1 = NULL;
    791794    char *command = NULL;
    792795    char *iso_mnt = NULL;
     
    836839
    837840            if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) {
    838                 paranoid_free(bkpinfo->prefix);
    839                 bkpinfo->prefix = value;
     841                paranoid_alloc(bkpinfo->prefix,value);
    840842            } else {
    841843                paranoid_alloc(bkpinfo->prefix, STD_PREFIX);
     
    845847            paranoid_free(value);
    846848            if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) {
    847                 paranoid_free(bkpinfo->prefix);
    848                 bkpinfo->prefix = value;
     849                paranoid_alloc(bkpinfo->prefix,value);
    849850            } else {
    850851                paranoid_alloc(bkpinfo->prefix, STD_PREFIX);
     
    869870        } else if (bkpinfo->backup_media_type == tape
    870871                   || bkpinfo->backup_media_type == udev) {
     872            paranoid_free(bkpinfo->media_device);
    871873            if (read_cfg_var(cfg_file, "media-dev", bkpinfo->media_device)) {
    872874                fatal_error("Cannot get tape device name from cfg file");
     
    964966                    "...cos it wouldn't make sense to abandon the values that GOT ME to this config file in the first place");
    965967        } else {
     968            paranoid_free(bkpinfo->nfs_mount);
     969            paranoid_free(bkpinfo->nfs_remote_dir);
    966970            read_cfg_var(g_mondo_cfg_file, "nfs-server-mount",
    967971                         bkpinfo->nfs_mount);
     
    976980         * isodir in disaster recovery mode
    977981         */
    978         old_isodir = bkpinfo->isodir;
     982        paranoid_alloc(old_isodir,bkpinfo->isodir);
    979983        read_cfg_var(g_mondo_cfg_file, "iso-mnt", iso_mnt);
    980984        read_cfg_var(g_mondo_cfg_file, "isodir", iso_path);
    981985        if (iso_mnt && iso_path) {
     986            paranoid_free(bkpinfo->isodir);
    982987            asprintf(&bkpinfo->isodir, "%s%s", iso_mnt, iso_path);
    983         } else {
    984             bkpinfo->isodir = old_isodir;
    985988        }
    986989        paranoid_free(iso_mnt);
     
    992995                    ("user nominated isodir differs from archive, keeping user's choice: %s %s\n",
    993996                     old_isodir, bkpinfo->isodir);
    994                 if (bkpinfo->isodir != old_isodir) {
    995                     paranoid_free(old_isodir);
    996                 }
    997             } else {
    998                 paranoid_free(old_isodir);
    999             }
    1000         }
    1001 
     997            }
     998        }
     999        paranoid_free(old_isodir);
     1000
     1001        paranoid_free(g_isodir_device);
    10021002        read_cfg_var(g_mondo_cfg_file, "iso-dev", g_isodir_device);
    10031003        log_msg(2, "isodir=%s; iso-dev=%s", bkpinfo->isodir, g_isodir_device);
     
    10291029                    paranoid_free(iso_mnt);
    10301030                    paranoid_free(iso_path);
    1031                     asprintf(&iso_mnt, "");
    1032                     asprintf(&iso_path, "");
     1031                    asprintf(&iso_mnt, "%s", "");
     1032                    asprintf(&iso_path, "%s", "");
    10331033
    10341034                    if (mount_cdrom(bkpinfo)) {
     
    10691069    }
    10701070    g_backup_media_type = bkpinfo->backup_media_type;
     1071    bkpinfo->backup_media_string = bkptype_to_string(bkpinfo->backup_media_type);
     1072    g_backup_media_string = bkpinfo->backup_media_string;
    10711073    return (0);
    10721074}
     
    18231825    assert(bkpinfo != NULL);
    18241826
    1825     malloc_string(g_tmpfs_mountpt);
    1826 
    18271827    asprintf(&g_biggielist_txt, "%s/%s",bkpinfo->tmpdir , BIGGIELIST_TXT_STUB);
    18281828    asprintf(&g_filelist_full, "%s/%s", bkpinfo->tmpdir, FILELIST_FULL_STUB);
     
    18301830    asprintf(&g_imagedevs_restthese, "%s/tmp/imagedevs.restore-these",
    18311831            bkpinfo->tmpdir);
     1832    paranoid_free(g_mondo_cfg_file);
     1833    paranoid_free(g_mountlist_fname);
    18321834    if (bkpinfo->disaster_recovery) {
    18331835        asprintf(&g_mondo_cfg_file, "/%s", MONDO_CFG_FILE_STUB);
     
    21102112{
    21112113    int retval = 0;
    2112     char *device = NULL;
    21132114    char *command = NULL;
    21142115    char *cfg_file = NULL;
     
    23642365
    23652366    g_backup_media_type = bkpinfo->backup_media_type;
     2367    bkpinfo->backup_media_string = bkptype_to_string(bkpinfo->backup_media_type);
     2368    g_backup_media_string = bkpinfo->backup_media_string;
    23662369    return (retval);
    23672370}
  • trunk/monitas/client.c

    r353 r783  
    152152char *get_param_from_rcfile(char*fname, char*field)
    153153{
    154   char command[MAX_STR_LEN+1], tmp[MAX_STR_LEN+1];
     154  char command[MAX_STR_LEN+1];
     155  char tmp[MAX_STR_LEN+1];
    155156  static char sz_res[MAX_STR_LEN+1];
    156157
  • trunk/tools/mg

    r407 r783  
    1 egrep -ri $* . | egrep -v '\.svn|~:' | less
     1egrep -ri $* . | egrep -v '\.svn|~:'
Note: See TracChangeset for help on using the changeset viewer.