~fourmond/pmount/pmount-new

« back to all changes in this revision

Viewing changes to src/pmount-hal.c

  • Committer: martin at piware
  • Date: 2007-01-11 15:30:39 UTC
  • Revision ID: martin@piware.de-20070111153039-6stkvny0z9n57zrq
fix dbus connection: we cannot close a shared connection

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include "fs.h"
24
24
#include "utils.h"
25
25
 
26
 
#include "realpath.h"
27
 
 
28
26
/* gettext abbreviation */
29
27
#define _(String) gettext(String)
30
28
 
113
111
 
114
112
void exec_pmount( const char* device, const char* fstype, const char* label,
115
113
        dbus_bool_t sync, dbus_bool_t noatime, dbus_bool_t exec, const char*
116
 
        umask, const char *fmask, const char *dmask, const char* iocharset, int addargc, const char* const* addargv ) 
 
114
        umask, const char* iocharset, int addargc, const char* const* addargv ) 
117
115
{
118
116
    const char** argv = (const char**) calloc( sizeof( const char* ), addargc+15 );
119
117
    int argc = 0;
139
137
        argv[argc++] = umask;
140
138
    }
141
139
 
142
 
    if ( fmask ) {
143
 
        argv[argc++] = "--fmask";
144
 
        argv[argc++] = fmask;
145
 
    }
146
 
 
147
 
    if ( dmask ) {
148
 
        argv[argc++] = "--dmask";
149
 
        argv[argc++] = dmask;
150
 
    }
151
 
 
152
140
    if( iocharset ) {
153
141
        argv[argc++] = "-c";
154
142
        argv[argc++] = iocharset;
192
180
    LibHalDrive* drive;
193
181
    dbus_bool_t sync = FALSE, noatime = FALSE, exec = FALSE;
194
182
    char *umask = NULL;
195
 
    char *fmask = NULL;
196
 
    char *dmask = NULL;
197
183
    char *iocharset = NULL;
198
184
 
199
185
    /* initialize locale */
372
358
 
373
359
    debug( "umask: %s\n", umask );
374
360
 
375
 
    if( volume && libhal_device_property_exists( hal_ctx,
376
 
                libhal_volume_get_udi( volume ), "volume.policy.mount_option.fmask", &error ) )
377
 
        fmask = libhal_device_get_property_string( hal_ctx,
378
 
                libhal_volume_get_udi( volume ), "volume.policy.mount_option.fmask", &error );
379
 
    else if( libhal_device_property_exists( hal_ctx, 
380
 
                libhal_drive_get_udi( drive ), "storage.policy.mount_option.fmask", &error ) )
381
 
        fmask = libhal_device_get_property_string( hal_ctx,
382
 
                libhal_drive_get_udi( drive ), "storage.policy.mount_option.fmask", &error );
383
 
    else if( libhal_device_property_exists( hal_ctx, computer_udi, "storage.policy.default.mount_option.fmask", &error ) )
384
 
        fmask = libhal_device_get_property_string( hal_ctx, computer_udi, "storage.policy.default.mount_option.fmask", &error );
385
 
 
386
 
    debug( "fmask: %s\n", fmask );
387
 
 
388
 
    if( volume && libhal_device_property_exists( hal_ctx,
389
 
                libhal_volume_get_udi( volume ), "volume.policy.mount_option.dmask", &error ) )
390
 
        dmask = libhal_device_get_property_string( hal_ctx,
391
 
                libhal_volume_get_udi( volume ), "volume.policy.mount_option.dmask", &error );
392
 
    else if( libhal_device_property_exists( hal_ctx, 
393
 
                libhal_drive_get_udi( drive ), "storage.policy.mount_option.dmask", &error ) )
394
 
        dmask = libhal_device_get_property_string( hal_ctx,
395
 
                libhal_drive_get_udi( drive ), "storage.policy.mount_option.dmask", &error );
396
 
    else if( libhal_device_property_exists( hal_ctx, computer_udi, "storage.policy.default.mount_option.dmask", &error ) )
397
 
        dmask = libhal_device_get_property_string( hal_ctx, computer_udi, "storage.policy.default.mount_option.dmask", &error );
398
 
 
399
 
    debug( "dmask: %s\n", dmask );
400
 
 
401
361
    /* shut down hal connection */
402
362
    libhal_ctx_shutdown( hal_ctx, &error );
403
363
    libhal_ctx_free( hal_ctx );
405
365
    dbus_connection_unref( dbus_conn );
406
366
 
407
367
    /* go */
408
 
    exec_pmount( device, fstype, label, sync, noatime, exec, umask, fmask, dmask, iocharset, argc-2, argv+2 );
 
368
    exec_pmount( device, fstype, label, sync, noatime, exec, umask, iocharset, argc-2, argv+2 );
409
369
 
410
370
    return 0;
411
371
}