~ubuntu-branches/ubuntu/wily/fwts/wily

« back to all changes in this revision

Viewing changes to src/lib/src/fwts_log.c

  • Committer: Package Import Robot
  • Author(s): Ivan Hu, Alex Hung, Colin Ian King, Ivan Hu, Naresh Bhat
  • Date: 2015-01-21 10:39:00 UTC
  • mfrom: (34.2.23)
  • Revision ID: package-import@ubuntu.com-20150121103900-eozocxj45stjs43n
Tags: 15.01.00-0ubuntu0
[Alex Hung]
* live-image/fwts-frontend-text: skip moving and avoid overwritting
  results.html (LP: #1322520)
* acpi: method: add check for _PSD
* acpi: method: add check for _PRW

[Colin Ian King]
* acpi: acpidump: reduce scope of variables
* acpi: battery: reduce scope of variables
* acpi: brightness: reduce scope of variables
* acpi: brightness: reduce scope of variables
* acpi: crsdump: reduce scope of variables
* acpi: lid: reduce scope of variables
* utilities: kernelscan: reduce scope of variables
* uefi: uefirtvariable: reduce scope of variables
* acpi: dmar: reduce scope of variables
* acpi: pcc: reduce scope of variables
* acpi: method: reduce scope of variables
* acpi: s3: reduce scope of variables
* acpi: s3power: reduce scope of variables
* acpi: s4: reduce scope of variables
* bios: hdaaudio: reduce scope of variables
* bios: mtrr: reduce scope of variables
* bios: multiproc: reduce scope of variables
* cpu: cpufreq: reduce scope of variables
* cpu: maxfreq: reduce scope of variables
* cpu: microcode: reduce scope of variables
* cpu: msr: reduce scope of variables
* cpu: nx: reduce scope of variables
* hotkey: reduce scope of variables
* hpet: hpet_check: reduce scope of variables
* lib: fwts_acpi_tables: reduce scope of variables
* lib: fwts_backtrace: reduce scope of variables
* lib: fwts_battery: reduce scope of variables
* lib: fwts_dump: replace asctime with strftime
* lib: fwts_efi_module: reduce scope of variable
* cmos: cmosdump: clarify precedence for & and ?
* lib: fwts_framework: fix some minor style warnings from cppcheck
* lib: fwts_gpe: reduce scope of variables
* lib: fwts_memorymap: fix typo on memory comparison sort
* lib: fwts_memorymap: reduce scope of variables
* lib: fwts_log: reduce scope of variables
* lib: fwts_pm_method: reduce scope of variables
* reduce scope of variables
* lib: fwts_uefi: reduce scope of variables
* pci: aspm: reduce scope of variables
* lib: klog: reduce scope of variables
* uefi: uefibootpath: reduce scope of variables
* uefi: securebootcert: reduce scope of variables
* uefi: uefidump: reduce scope of variables
* uefi: uefirtauthvar: reduce scope of variables
* uefi: uefirtmisc: reduce scope of variables
* uefi: uefivarinfo: reduce scope of variables

[Ivan Hu]
* uefibootpath: include the null-terminated space in device path length
* fwts-test: update fwts tests to sync with method tests

[Naresh Bhat]
* makefile.am : Use sysroot path for json

Show diffs side-by-side

added added

removed removed

Lines of Context:
202
202
void fwts_log_print_fields(void)
203
203
{
204
204
        fwts_log_field field = 1;
205
 
        char *str;
206
205
 
207
206
        printf("Available fields: ");
208
207
        for (field=1; ; field <<= 1) {
209
 
                str = fwts_log_field_to_str(field);
 
208
                char *str = fwts_log_field_to_str(field);
210
209
                if (strcmp(str, LOG_UNKOWN_FIELD) == 0)
211
210
                        break;
212
211
                printf("%s%s", field == 1 ? "" : ",", str);
277
276
 */
278
277
void fwts_log_set_field_filter(const char *str)
279
278
{
280
 
        char *token;
281
279
        char *saveptr;
282
280
        fwts_log_field field;
283
281
 
284
282
        for (;; str=NULL) {
 
283
                char *token;
 
284
 
285
285
                if ((token = strtok_r((char*)str, ",|", &saveptr)) == NULL)
286
286
                        break;
287
287
                if (*token == '^' || *token == '~') {
336
336
        char *new_name;
337
337
        char *suffix;
338
338
        size_t suffix_len;
339
 
        size_t trunc_len;
340
339
        size_t filename_len;
341
340
        struct stat stat_buf;
342
341
 
366
365
                 !strcmp(ptr, ".json") ||
367
366
                 !strcmp(ptr, ".xml") ||
368
367
                 !strcmp(ptr, ".html"))) {
 
368
                size_t trunc_len = ptr - filename;
369
369
 
370
 
                trunc_len = ptr - filename;
371
370
                if ((new_name = calloc(trunc_len + suffix_len + 1, 1)) == NULL) {
372
371
                        fprintf(stderr, "Cannot allocate log name.\n");
373
372
                        return NULL;
408
407
        va_list args;
409
408
        int ret = 0;
410
409
 
411
 
        char buffer[LOG_MAX_BUF_SIZE];
412
 
 
413
410
        if (!((field & LOG_FIELD_MASK) & fwts_log_filter))
414
411
                return ret;
415
412
 
416
413
        if (log && log->magic == LOG_MAGIC) {
417
414
                fwts_list_link *item;
 
415
                char buffer[LOG_MAX_BUF_SIZE];
418
416
 
419
417
                /*
420
418
                 * With the possibility of having multiple logs being written